Has anyone encountered this?
var_dump(CRYPT_SHA256 == 1); // returns bool(true)
var_dump(defined(CRYPT_SHA256)); // returns bool(false)
A constant is an identifier (name) for a simple value. The value cannot be changed during the script. A valid constant name starts with a letter or underscore (no $ sign before the constant name).
define() function in PHP The define() function defines a constant.
Q 3 - Which of the following is correct about constants vs variables in PHP? A - Constants may be defined and accessed anywhere without regard to variable scoping rules.
constant() is useful if you need to retrieve the value of a constant, but do not know its name. I.e. it is stored in a variable or returned by a function. This function works also with class constants.
defined('CRYPT_SHA256')
Otherwise, you are asking whether the value of the CRYPT_SHA256
constant is also the name of another constant....
defined(CRYPT_SHA256) === defined('1');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With