Skip to content
Advertisement

Tag: constants

Getting an error using constants

I have a lot of pages, all of which require the file characters.php. This file contains constants which define many things in my website. They are defined like this, for example: const $humanHEALTH = …

How can I change PHP constants? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question I am working on making my own custom CMS in PHP by hand and I have a few constants I

Redefining constants in PHP

Is it possible to redefine a constant in php which was defined by the define function? I have a class with several constants that contains the user data. I’m trying to use the class for more than one user. I did not write this class, but I am using it due to time constraints. I do not know why the

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: Now, when I add the single quotes to the mode argument, the first error goes away,

PHP | define() vs. const

In PHP, you can declare constants in two ways: With define keyword Using const keyword What are the main differences between those two? When and why should you use one and when use the other? Answer As of PHP 5.3 there are two ways to define constants: Either using the const keyword or using the define() function: The fundamental difference

Advertisement