N 個の (N 個を知らずに) 要素を持つ配列を動的に作成したいと考えています。
関数のようなもの
public function create_array($num_elements){
.....
}
それは私に次のようなものを返します
//call the function....
create_array(3);
//and the output is:
array{
0 => null
1 => null
2 => null
}
array_fill
単純なforeach
ループについてはすでに考えました。
他の解決策はありますか?