Project Euler Solutions by Ross Marks

<?php
/*****************************
 * ProjectEuler - Problem 34
 * By Ross Marks
 *****************************
 * 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
 * 
 * Find the sum of all numbers which are equal to the sum of the factorial of their digits.
 * 
 * Note: as 1! = 1 and 2! = 2 are not sums they are not included.
 ****************************/
$awns 0;

//echo getFactorial(5);

for($i 10$i<= 100000$i++){
    
$current_no 0;
    
$string = (string)$i;
    
//echo "$i: ";
    
for($j 0$j strlen($string); $j++){
        @
$check $string[$j];
        
$fact getFactorial((int)$check);
        
$current_no += $fact;
        
//echo "$fact ";
    
}
    if(
$i == $current_no){
        echo 
"found: $i\n";
        
$awns bcadd($awns$i);
    }else{
        
//echo " $current_no\n";
    
}
}

echo 
"Answer: $awns";

function 
getFactorial($num){
    
$fact 1;
    for(
$i 1$i <= $num ;$i++)
        
$fact $fact $i;
    return 
$fact;
}

?>