我怎么能值此数组 [英] How can i take the values from this array

查看:111
本文介绍了我怎么能值此数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能走SchoolType,SchoolLocation,DegreeName,起始日期和结束日期?

How can i take the SchoolType, SchoolLocation, DegreeName, StartDate and EndDate ?

我试图采取这样的值

foreach ($Edu as $attr)
{
 $attr->SchoolType;
}

但它显示我的空值。

But it is showing me the empty value.

下面是我的阵列

    Array (
    [@attributes] => Array (
    [SchoolType] => University
    )
    [School] => Array (
    [SchoolName] => Northeastern University
    )
    [SchoolLocation] => Northeastern
    [Degree] => Array (
    [@attributes] => Array (
    [DegreeType] => Graduate/ Undergraduate
    )
    [IsHighestDegee] => True
    [DegreeName] => Bachelor
    [DegreeDate] => Array (
    [0] => Array (
    )
    )
    [DegreeMajor] => Array (
    [Name] => Science
    )
    [EducationDetails] => Science
    [DegreeMeasure] => Array (
    [EducationMeasure] => Array (
    [MeasureSystem] => Array (
    )
    [MeasureValue] => Array (
    [0] => Array (
    )
    )
    )
    )
    [DateofAttendance] => Array (
    [StartDate] => Array (
    [0] => Array (
    )
    )
    [EndDate] => Array (
    [0] => Array (
    )
    )
    )
    [EducationDescription] => Northeastern University, Boston MA Bachelor of Science, Business Administration
    )
    )

请帮我把这个单一阵列中的值。

Please help me to take the values in this single array.

推荐答案

如果$埃杜是包含你写数据时,阵列code

If $Edu is array containing the data you wrote, code

var_dump($Edu['@attributes']['SchoolType']);
var_dump($Edu['SchoolLocation']);
var_dump($Edu['Degree']['DegreeName']);
var_dump($Edu['Degree']['DateofAttendance']['StartDate']);
var_dump($Edu['Degree']['DateofAttendance']['StartDate'][0]);

给出结果。

string(10) "University"
string(12) "Northeastern"
string(8) "Bachelor"
array(1) { [0]=> array(0) { } }
array(0) { }

这篇关于我怎么能值此数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆