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 git.master, git.master_jit, rfc.property-hooks
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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.38 ms | 401 KiB | 8 Q