我有一个如下数组,我想从此数组中获取任何特定元素:数组存储在变量中。
$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] => <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bdced5d2dcd4dffdc9d8ded5d1d8dcd9c793ded2d0" rel="noreferrer noopener nofollow">[email protected]</a>
[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:"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9fecf7f0fef6fddfebfafcf7f3fafefbe5b1fcf0f2" rel="noreferrer noopener nofollow">[email protected]</a>";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] => <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a3d0cbccc2cac1e3d7c6c0cbcfc6c2c7d98dc0ccce" rel="noreferrer noopener nofollow">[email protected]</a>
[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:"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9eedf6f1fff7fcdeeafbfdf6f2fbfffae4b0fdf1f3" rel="noreferrer noopener nofollow">[email protected]</a>";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] => <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="32415a5d535b50724657515a5e575356481c515d5f" rel="noreferrer noopener nofollow">[email protected]</a>
[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:"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ea9982858b8388aa9e8f8982868f8b8e90c4898587" rel="noreferrer noopener nofollow">[email protected]</a>";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
)
)
现在我有一个像这样的数组,那么我如何获取该数组中[已提交] foreach 元素的值。
最佳答案
关于php - 从数组中获取特定元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34964182/