3v4l.org

run code in 300+ PHP versions simultaneously
<?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.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
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.5.24 - 5.5.35, 5.6.8 - 5.6.28
Fatal error: Call to undefined function t() in /in/FPBUG on line 7
Process exited with code 255.

preferences:
159.92 ms | 402 KiB | 183 Q