Skip to content

Instantly share code, notes, and snippets.

@vamsiikrishna
Created October 20, 2016 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vamsiikrishna/4aee30d53edd71c944dbd7451dcf0083 to your computer and use it in GitHub Desktop.
Save vamsiikrishna/4aee30d53edd71c944dbd7451dcf0083 to your computer and use it in GitHub Desktop.
Problem 2 - Project Euler in PHP
<?php
list($a, $b) = [1,1];
$total = 0;
while($a <= 4000000) {
if($a % 2 === 0) {
$total += $a;
}
list($a, $b) = [$b, $a+$b];
}
echo $total;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment