我有以下数组,其中我只想获取每个条目的类型和字段的值,并回显它们。不确定如何使用尽可能短的代码执行此操作。
Array
(
[0] => stdClass Object
(
[Field] => id
[Type] => int(11)
[Null] => NO
[Key] => PRI
[Default] =>
[Extra] => auto_increment
)
[1] => stdClass Object
(
[Field] => field2
[Type] => varchar(64)
[Null] => NO
[Key] =>
[Default] =>
[Extra] =>
)
)
答案 0 :(得分:1)
foreach($arr as $object){
echo $object->Field . ': ' . $object->Type;
}