PHP 8.2.20 Released!

Voting

: min(seven, three)?
(Example: nine)

The Note You're Voting On

hellekin
14 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