Created
November 2, 2022 18:25
-
-
Save Sirpyerre/1ce0b75be20c15797023237aa977db2b to your computer and use it in GitHub Desktop.
PHP ternary operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$eligible = true; | |
$hasCredit = false; | |
$message = $eligible ? | |
($hasCredit? 'Can use the credit':'Not enough credit') | |
: 'Not eligible to buy'; | |
echo $message; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment