Skip to content
Advertisement

PHP Undefined Constant PHP_ROUND_HALF_DOWN

I have some PHP code in a project I’m working on that uses PHP’s round function. On my localhost, I don’t include any quotes around my mode argument, stating it as just PHP_ROUND_HALF_DOWN. However, when pushing to my server I get the error message:

JavaScript

Now, when I add the single quotes to the mode argument, the first error goes away, however the “wrong parameter count” remains. I’m calling the function as follows:

JavaScript

Thanks for any and all help!

Advertisement

Answer

The rounding mode was added in PHP 5.3. Make sure you’re running at least that version.

You can see which version you’re running by placing the following in a PHP file:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement