mirror of
https://github.com/RustyRaptor/ProgrammingLanguages.git
synced 2026-12-04 05:55:15 -07:00
19 lines
499 B
PHP
19 lines
499 B
PHP
<?php
|
|
|
|
// Function that prints a string when we don't have short-circuit evaluation.
|
|
function print_answer() {
|
|
echo "We DO NOT have short-circuit evaluation!\n";
|
|
return true;
|
|
}
|
|
|
|
// Set A to false
|
|
$A = false;
|
|
|
|
// f they are both true print that they are both true
|
|
// Else print a string to helpdetermine if w have short circuit evaluation.
|
|
if ($A && print_answer()) {
|
|
echo "Both A and B are true\n";
|
|
} else {
|
|
echo "If you only see this then we DO have short circuit evaluation\n";
|
|
}
|