3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $torrent = 'd8:announce37:http://blender.waag.org:6969/announce13:creation datei1212070099e4:infod6:lengthi196898674e4:name30:big_buck_bunny_720p_stereo.ogg12:piece lengthi262144e6:pieces15040:DñÀsÑ45/'; $old = "/name([0-9]+):(.*?):/i"; $regex = "/lengthi([0-9]+)e[0-9]/i"; $sizes = array(); preg_replace_callback($regex, function($matches) use(&$sizes) { $sizes[] = substr($matches[2], 0, $matches[1]); }, $torrent); var_dump($sizes);
Output for 7.0.0 - 7.1.0
Notice: Undefined offset: 2 in /in/GYLHs on line 13 Notice: Undefined offset: 2 in /in/GYLHs on line 13 array(2) { [0]=> string(0) "" [1]=> string(0) "" }
Output for 5.3.0 - 5.6.28
Notice: Undefined offset: 2 in /in/GYLHs on line 13 Notice: Undefined offset: 2 in /in/GYLHs on line 13 array(2) { [0]=> bool(false) [1]=> bool(false) }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/GYLHs on line 10
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 T_FUNCTION in /in/GYLHs on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/GYLHs on line 10
Process exited with code 255.