Php 从数组中获取特定元素

Php 从数组中获取特定元素,php,arrays,Php,Arrays,我有一个数组,如下所示,我想从这个数组中获取任何特定的元素:数组存储在变量中 $results = Array ( [0] => stdClass Object ( [id] => 1 [calendar] => 1 [time] => 2016-01-22 17:25:28 [booked_ti

我有一个数组,如下所示,我想从这个数组中获取任何特定的元素:数组存储在变量中

   $results = 

        Array
           (
        [0] => stdClass Object
                         (
        [id] => 1
        [calendar] => 1
        [time] => 2016-01-22 17:25:28
        [booked_time] => 01/22/2016 11:00
        [booked_time_unformatted] => 2016-01-22 11:00:00
        [name] => Shoaib
        [email] => shoaib@techleadz.com
        [phone] => 0987654321
        [question] => 123
        [quantity] => 1
        [buffered_date] => a:9:{s:5:"PRICE";s:2:"25";s:10:"COUPONCODE";s:0:"";s:8:"QUANTITY";N;s:4:"NAME";s:6:"Shoaib";s:5:"EMAIL";s:20:"shoaib@techleadz.com";s:5:"PHONE";s:10:"0987654321";s:8:"COMMENTS";s:3:"123";s:4:"DATE";s:10:"01/22/2016";s:4:"TIME";s:5:"11:00";}
        [submitted] => 1
    )

[1] => stdClass Object
    (
        [id] => 2
        [calendar] => 1
        [time] => 2016-01-23 10:39:30
        [booked_time] => 01/25/2016 15:00
        [booked_time_unformatted] => 2016-01-25 15:00:00
        [name] => Shoaib
        [email] => shoaib@techleadz.com
        [phone] => 0987654321
        [question] => dsadasd
        [quantity] => 1
        [buffered_date] => a:9:{s:5:"PRICE";s:2:"25";s:10:"COUPONCODE";s:0:"";s:8:"QUANTITY";N;s:4:"NAME";s:6:"Shoaib";s:5:"EMAIL";s:20:"shoaib@techleadz.com";s:5:"PHONE";s:10:"0987654321";s:8:"COMMENTS";s:7:"dsadasd";s:4:"DATE";s:10:"01/25/2016";s:4:"TIME";s:5:"15:00";}
        [submitted] => 1
    )

[2] => stdClass Object
    (
        [id] => 3
        [calendar] => 1
        [time] => 2016-01-23 11:27:22
        [booked_time] => 01/25/2016 11:00
        [booked_time_unformatted] => 2016-01-25 11:00:00
        [name] => test
        [email] => shoaib@techleadz.com
        [phone] => 0987654321
        [question] => asfas
        [quantity] => 1
        [buffered_date] => a:9:{s:5:"PRICE";s:2:"25";s:10:"COUPONCODE";s:0:"";s:8:"QUANTITY";N;s:4:"NAME";s:4:"test";s:5:"EMAIL";s:20:"shoaib@techleadz.com";s:5:"PHONE";s:10:"0987654321";s:8:"COMMENTS";s:5:"asfas";s:4:"DATE";s:10:"01/25/2016";s:4:"TIME";s:5:"11:00";}
        [submitted] => 0
    )

            )

现在我有了一个这样的数组,所以我如何才能获得该数组中每个元素的[submitted]值。

这不是一个数组。这是一个物体

访问stdClass中的信息

 $results[6]->submitted;

要随机访问特定字段,请使用

echo $results[0]->submitted;
echo $results[0]->quantity;
echo $results[1]->submitted;
echo $results[1]->quantity;
使用foreach循环

foreach ( $results as $result ) {
    echo $result->submitted . '<br>';  

    echo $result->booked_time . '<br>';
    echo $result->name . '<br>';
    echo $result->time . '<br>';
    echo $result->email . '<br>';
}
foreach($results as$result){
echo$result->已提交。“
”; echo$result->预定时间。“
”; echo$result->name.“
”; echo$result->time.“
”; echo$result->email.“
”; }
具体的
是什么意思?
$results[6]
$results[6]->名称。例如,为什么是6tx而不是第5个?特定元素,如:[提交]只需使用foreach迭代数组,
foreach($results as$result)echo$result->submittedowh!:-/对不起,我的错:-/。