You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While there may indeed be an area of improvement here, your example is flawed, in that defined() only works with constants, yet in your example you've got $key as a variable.
No, defined() works with strings and NOT constants. If you pass a constant to defined, you check if the value of the constant is defined as a separate constant.
See:
$key = 'HELLO';
define( $key, 'world' );
if ( defined( $key ) ) {
echo 'checked as string';
}
if ( defined( HELLO ) ) {
echo 'checked as constant';
}
gives error WordPressVIPMinimum.Constants.ConstantString.NotCheckingConstantName:
Constant name, as a string, should be used along with
defined()
.which is wrong, as it is checked with defined.
The text was updated successfully, but these errors were encountered: