update page now
PHP 8.1.34 Released!

Voting

: min(two, nine)?
(Example: nine)

The Note You're Voting On

hellekin
15 years ago
Checking if a constant is empty is bork... 

You cannot

<?php
define('A', '');
define('B', 'B');

if (empty(B)) // syntax error
if (empty(constant('B'))) // fatal error

// so instead, thanks to LawnGnome on IRC, you can cast the constants to boolean (empty string is false)
if (((boolean) A) && ((boolean) B)) 
  // do stuff
?>

<< Back to user notes page

To Top