How can I destroy const? I tried disabling (KEY) but did not work.
<?php define('KEY', 'value'); echo KEY; //output value unset( KEY ); //no work ?>
Constants created with define() cannot be undefined after creation.
define()
Closest you can disable the constant - use the RunKit extension. See http://php.net/manual/en/function.runkit-constant-remove.php
You cannot destroy a constant or change its value at run time.
Your best option is to use a variable.
$key = "value"; echo $key; unset($key);
Not to mention; If you could, this would be extremely bad practice: P
It's impossible. If you could disable the constant, then it will not be very constant!
If you really need to remove this constant, you probably need to use a variable.
You cannot destroy or disable a constant in PHP, and its value cannot change by the value of Script.