3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['x', 'y', 'z']; foreach($array as &$element) { if ($element=='x') { $element = 'a'; } } var_dump($array);

preferences:
30.67 ms | 404 KiB | 5 Q