3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = array( 0, 1, '1', 1.1, 1.00, 1.01, 2.33, 3.445, -3.45, 12.3432.23 ); foreach($values as $value) { $isValid = false; $value = abs($value); $regexp = '/^[0-9]+\.[0-9][0-9]?$/'; $result = preg_match($regexp, $value, $matches); if(count($matches) == 1) $isValid = true; var_dump($result); if($isValid) { echo $value."\n"; } }
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '.23' (T_DNUMBER), expecting ')' in /in/J46lp on line 15
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_DNUMBER, expecting ')' in /in/J46lp on line 15
Process exited with code 255.

preferences:
179.27 ms | 1395 KiB | 65 Q