Im trying to get to grips with php (rather unsuccessfully). I keep getting tripped up on the syntax for defining and calling functions
the code ive written is
$alpha = array(1, "alpha");
$beta = array(2, "beta");
function find_best_provider($provider1, $provider2){
if($provider1 > $provider2){
return array($provider1[0], $provider1[1]);
}
else {
return array($provider2[0], $provider2[1]);
}
}
$winner = find_best_provider($alpha, $beta);
echo $winner;
But i keep getting this notice - Notice: Array to string conversion in /Applications/MAMP/htdocs/find_best_provier_func.php on line 17 Array
Im aware what the problem is but im not quite sure how to solve it, any helps much appreciated !
$provider1 > $provider2that's not how you should compare two arrays$provider1 > $provider2is not valid checking.else...