サンプルコード 実行結果
Fatal error: Call-time pass-by-reference has been removed; If you would like to pass argument by reference, modify the declaration of foo(). in C:\xampp\htdocs\ t.php on line 8
Fatal error: Call-time pass-by-reference has been removed; If you would like to pass argument by reference, modify the declaration of foo(). in C:\xampp\htdocs\ t.php on line 8
memory 1:160 memory 2:128 memory 3:0個人的な予想に反してforよりforeachの方が省メモリであるという結果が出ました。
1 memory 1:56 memory 2:5324488と、このようにtest1とtest2ではメモリの使用量に大きな差が出ています。
time:0.10538291931152 memory:8653392配列のサンプルコード 実行結果
time:0.01983904838562 memory:8647760と、速度もメモリ使用量も配列のほうがパフォーマンスが高いという結果になりました。
string(21) "arr_object::offsetSet" string(21) "arr_object::offsetSet" string(21) "arr_object::offsetSet" string(24) "arr_object::offsetExists" bool(false) string(21) "arr_object::offsetGet" string(6) "array2" string(23) "arr_object::offsetUnset" arr_object Object ( [container:arr_object:private] => Array ( [0] => array1 [1] => array2 ) )