Coding question

5 months 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
New course: Desktop apps with Electron