3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [1, 2, 3, 4, 5]; // Ссылка $value на значение массива $array не удаляется после выхода из тела цикла и указывает на последний элемент массива. $array[2] также указывает на последний элемент. foreach ($array as &$value) { } // Каждый проход цикла устанавливается новое значение $value, к-рый указывает на последний элемент. foreach ($array as $key => $value) { echo 'Iteration #' . $key . ":\n"; echo '$value = ' . $value . ";\n"; echo '$array = [' . implode($array) . "];\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Iteration #0: $value = 1; $array = [12341]; Iteration #1: $value = 2; $array = [12342]; Iteration #2: $value = 3; $array = [12343]; Iteration #3: $value = 4; $array = [12344]; Iteration #4: $value = 4; $array = [12344];

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.73 ms | 401 KiB | 8 Q