简体   繁体   中英

php constant can be referenced but defined() returns false

Has anyone encountered this?

var_dump(CRYPT_SHA256 == 1); // returns bool(true)
var_dump(defined(CRYPT_SHA256)); // returns bool(false)
defined('CRYPT_SHA256')

否则,你问的是CRYPT_SHA256常量的是否也是另一个常量的名称....

defined(CRYPT_SHA256) === defined('1');

The first statement also return false for me.

I have changed it a little bit, see below

define('CRYPT_SHA256',1);
  //var_dump(CRYPT_SHA256 == 1); // returns bool(true)
  var_dump('CRYPT_SHA256');
var_dump(defined('CRYPT_SHA256')); // returns bool(false)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM