PHP 7.4.12 Released!

Voting

Please answer this simple SPAM challenge: min(five, nine)?
(Example: nine)

The Note You're Voting On

G
3 years ago
Do note, using the ternary operator shorthand (since 5.3), omitting the 2nd expression the first expression will only be called once.

Before 5.3 (or not using the shorthand)
<?php
$val
= f('x') ? f('x') : false;
// f('x') will be run twice
?>

After 5.3
<?php
$val
= f('x') ?: false;
// f('x') will be run once
?>

<< Back to user notes page

To Top