Coding question

2 years ago

Michael3823

a function that returns the sum of 2 of the biggest numbers in the array.

Code

function sumOfTwo(array $array ){
	
	$firstValue;
	$secondValue;
	
	foreach ($array as $i) {

    	if($i > $value){
    		$secondValue = $firstValue;
    		$firstValue = $i;
    	}
    	else if($i > $secondValue and 
    		$i != $firstValue){
    	$secondValue = $i;
          
    	}
	}

return($firstValue + $secondValue);

  
}

Output

Error: spawn php ENOENT
HELO: Local email testing for your desktop!