Skip to content

Instantly share code, notes, and snippets.

@robbieaverill
Created September 20, 2016 05:56
Show Gist options
  • Save robbieaverill/f61ea26f70a8598d9564cda1293611ab to your computer and use it in GitHub Desktop.
Save robbieaverill/f61ea26f70a8598d9564cda1293611ab to your computer and use it in GitHub Desktop.
<?php
/**
* Screw you John Campbell! I couldn't work it out either!
*/
for ($found = false, $a = 20, $b = 60; $found === false; $a++, $b++) {
if ($a + 20 === $b - 20 && ($a - 22) * 2 === $b) {
$found = true;
echo "$a + 20 = " . ($a+20) . " and $b - 20 = " . ($b-20), PHP_EOL;
echo "$a - 22 = " . ($a-22) . " which doubled is the same as $b", PHP_EOL;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment