如何在一行上获得数组键的回声?
[The] => s
[revelation] => b
[that] => z
[the] => d
[Star] => e
[Wars] => h
结果:
<p>The revelation that the Star Wars.</p>
答案 0 :(得分:3)
非常简单:
$myArray = [
'The' => 's',
'revelation' => 'b',
'that' => 'z',
'the' => 'd',
'Star' => 'e',
'Wars' => 'h',
];
echo implode(' ', array_keys($myArray));
这基本上得到一个键的数组,然后用空格内容。