3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $s = '3.14'; $i = 1; $numberRegex = '/-?(?:0|[1-9][0-9]*+)(?:\.[0-9]*+)?(?:[Ee][+-]?[0-9]+)?/A'; if ( preg_match( $numberRegex, $s, $matches, 0, --$i ) ) { $i += strlen( $matches[0] ); var_dump( array( 's', $matches[0] - 0 ) ); }
Output for 4.3.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> string(1) "s" [1]=> float(3.14) }
Output for 4.3.1 - 4.3.2
Warning: Wrong parameter count for preg_match() in /in/0jqBI on line 7
Output for 4.3.0
Warning: Wrong parameter count for preg_match() in /in/1CFeB on line 7