3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function decimal($check, $args) { $maxFractionalPlaces = isset($args[0]) ? $args[0] : 2; $maxIntegralPlaces = isset($args[1]) ? $args[1] : null; $allFractionalPlacesRequired = isset($args[2]) ? $args[2] : false; $seperator = t('common.decimalSeperator'); if ($seperator == 'common.decimalSeperator') { $seperator = '.'; } if ($seperator != '.') { $check = str_replace($seperator, '.', $check); } if (!is_numeric($check)) { return false; } if (!$allFractionalPlacesRequired) { $fractionalRegex = '\\.[0-9]{0,' . $maxFractionalPlaces . '}'; } else { $fractionalRegex = '\\.[0-9]{' . $maxFractionalPlaces . '}'; } if ($maxIntegralPlaces > 0) { $integralRegex = '[-+]?[0-9]{0,' . $maxIntegralPlaces . '}'; } else { $integralRegex = '[-+]?[0-9]*'; } $regex = '/^' . $integralRegex . $fractionalRegex . '$/'; if (!$allFractionalPlacesRequired) { if (preg_match('/^' . $integralRegex . '$/', $check) || preg_match($regex, $check)) { return true; } } else { if (preg_match($regex, $check)) { return true; } } return false; } var_dump(decimal(1.8867 ,array(4, 10)));
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function t() in /in/FPBUG:7 Stack trace: #0 /in/FPBUG(45): decimal(1.8867, Array) #1 {main} thrown in /in/FPBUG on line 7
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Call to undefined function t() in /in/FPBUG on line 7
Process exited with code 255.