3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arrayIterator = new ArrayIterator(array('test 1' => ['derp'], 'another test', 'test 123')); $regexIterator = new RegexIterator($arrayIterator, '/^test/', RegexIterator::REPLACE, RegexIterator::USE_KEY); $regexIterator->replacement = ''; foreach ($regexIterator as $value) { var_dump($value); echo "\n"; }
based on uJYHp
Output for 5.4.0 - 5.4.45, 5.6.28, 7.0.20 - 7.3.0beta1
array(1) { [0]=> string(4) "derp" }
Output for 5.5.24 - 5.6.21, 7.0.0 - 7.0.6
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/TbNf3 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/TbNf3 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/TbNf3 on line 2
Process exited with code 255.