3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str[] = "3543900000133243"; $str[] = "3543sssssxxxxxx23243"; $str[] = "1543344=-23-1--923243"; $pattern = "/\A3543(.+)3243\Z/"; foreach($str as $key=>$string) { if(preg_match($pattern,$string,$res)) { echo "found in $string: ".$res[1]." at position ".substr($string,$res[1]); } else { echo "not found in $string"; } }
Output for 7.0.0 - 7.1.0
found in 3543900000133243: 90000013 at position Warning: substr() expects parameter 2 to be integer, string given in /in/0Mfv5 on line 11 found in 3543sssssxxxxxx23243: sssssxxxxxx2 at position not found in 1543344=-23-1--923243
Output for 5.3.0 - 5.6.28
found in 3543900000133243: 90000013 at position Warning: substr() expects parameter 2 to be long, string given in /in/0Mfv5 on line 11 found in 3543sssssxxxxxx23243: sssssxxxxxx2 at position not found in 1543344=-23-1--923243
Output for 4.3.0 - 5.2.17
found in 3543900000133243: 90000013 at position found in 3543sssssxxxxxx23243: sssssxxxxxx2 at position 3543sssssxxxxxx23243not found in 1543344=-23-1--923243