3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = '763:74 74:274 177:474'; $result = []; preg_replace_callback('/(\d+):(\d+)/m',function($m,&$result){ $result[$m[1]] = $m[2]; },$string,$result); print_r($result); echo $result[74]."\n"; echo $result[763]."\n";
based on 17upY
Output for 7.0.0 - 7.2.0
Warning: preg_replace_callback() expects parameter 4 to be integer, array given in /in/lV6Db on line 10 Array ( ) Notice: Undefined offset: 74 in /in/lV6Db on line 13 Notice: Undefined offset: 763 in /in/lV6Db on line 14
Output for 5.4.9 - 5.6.28
Warning: preg_replace_callback() expects parameter 4 to be long, array given in /in/lV6Db on line 10 Array ( ) Notice: Undefined offset: 74 in /in/lV6Db on line 13 Notice: Undefined offset: 763 in /in/lV6Db on line 14
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/lV6Db on line 7
Process exited with code 255.