Skip to content

Instantly share code, notes, and snippets.

@TakesTheBiscuit
Created March 22, 2018 23:12
Show Gist options
  • Save TakesTheBiscuit/b9b3514eaf87f0706911caefe74acc4f to your computer and use it in GitHub Desktop.
Save TakesTheBiscuit/b9b3514eaf87f0706911caefe74acc4f to your computer and use it in GitHub Desktop.
Blog example juggling 2
<?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