I want to compare the values of two arrays that have the same key (The activity) and have the same length.
Arrays
$anna_array = array("soccer" => "10", "basketball" => "20", "atletics" => "40");
$john_array = array("soccer" => "15", "basketball" => "15", "atletics" => "45");
I want to have something like:
<?php
if ($anna_array['soccer'] > $john_array['soccer']){
$points = "1";
} else {
$points = "0";
}
?>
Then I will use $points in the results:
<?php
foreach ($anna_array as $x => $x_value) {
$speler1_prestaties = "<span class=\"white bold\">".str_pad($count1++, 2, "0", STR_PAD_LEFT)."</span> ".$x.":
<span class=\"orange\">".$x_value." "(".$points .")></span><br />";
echo $player1_info;
?>
Any help will be appreciated.