Created
March 22, 2018 23:12
-
-
Save TakesTheBiscuit/b9b3514eaf87f0706911caefe74acc4f to your computer and use it in GitHub Desktop.
Blog example juggling 2
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 | |
// balls becomes an INT | |
$balls = 1; | |
// truthy check (any INTEGER > 0 will be true) | |
if ($balls) { | |
$balls += 1; | |
} | |
// truthy check: $balls is an INTEGER at this point | |
if ($balls) { | |
$balls = true; | |
} | |
// $balls can be literally anything other than false | |
if ($balls != false) { | |
$balls = 'AlwaysBlue'; | |
} | |
// outputs: AlwaysBlue (STRING) | |
echo $balls; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment