Iきthis PHPスニペット:PHPの:すべての配列項目に連結した文字列
<?php
$colors = array('red','green','blue');
foreach ($colors as &$item)
{
$item = 'color-'.$item;
}
print_r($colors);
?>
出力:それは簡単な解決策
Array
(
[0] => car-red
[1] => car-green
[2] => car-blue
)
ですか?
(いくつかの配列PHP関数はarray_insert_before_all_items($ colors,"car-")
)?
おかげ