Javascript:
function defined( constant_name ) { // Checks whether a given named constant exists
//
// + original by: _argos
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
return (typeof window[constant_name] !== 'undefined');
}
Примеры:
defined('IMAGINARY_CONSTANT1');
false
|
|
|
|
спасибо, то что надо