組み込みの php 関数や、要素を配列の先頭に挿入する簡単な方法はありますか?
何かのようなもの:
$matches = Array("apples", "oranges");
insert_to_beginning($matches, "peach");
コンテンツ:
$matches[0] = peach
$matches[1] = apples
$matches[2] = oranges
組み込みの php 関数や、要素を配列の先頭に挿入する簡単な方法はありますか?
何かのようなもの:
$matches = Array("apples", "oranges");
insert_to_beginning($matches, "peach");
コンテンツ:
$matches[0] = peach
$matches[1] = apples
$matches[2] = oranges
array_unshift
あなたが探している機能です。
array_unshift($matches, "peach");
array_unshift($matches, 'peach');