我有这个数组
<?php
$themename = "So";
$shortname = "se";
$options = array (
array( "name" => "the_firstname",
"desc" => "The firstname of a person",
"id" => $shortname."_the_firstname",
"type" => "text",
"value" => ""),
array( "name" => "the_lastname",
"desc" => "A persons lastname",
"id" => $shortname."_the_lastname",
"type" => "text",
"value" => ""),
);
foreach($options as $key => $value)
{
echo $value['id']."<br/>";
}
?>
例如有相似的键,比如id
键。我想要访问第一个数组中的id
值。
使用echo $value['id'][0]."<br/>";
或者echo $options['id'][0]."<br/>";
并不能帮助解决问题。
我该如何显示第一个id
的值呢?
echo $options[0]['id']."<br/>"
- Eugen Rieck