php - checking array point with high score -


my intention check array , setting 1 of point high score , , if in array other 3 same score high score , echo there 2 same point else echo not same. checking point having same point.

my code

$dpoint =70; $ipoint =70; $hpoint =60; $apoint =60;  $score = $dpoint; high score  $xdata = array(             'd1' => $dpoint,             'i1' => $ipoint,             'h1' => $hpoint,             'a1' => $apoint             );      foreach($xdata $key => $value){     if($score == $value){     echo "there 2 same point";     }else{     echo "not same";     } } 

but getting werid result , part missed ? fix me

if understand well...

<?php     $dpoint =70;     $ipoint =70;     $hpoint =60;     $apoint =60;      $score = $dpoint;      $xdata = array(                    'd1' => $dpoint,                    'i1' => $ipoint,                    'h1' => $hpoint,                    'a1' => $apoint                    );      $matches = 0;     foreach($xdata $key => $value){         if($score == $value){             $matches ++;         }     }      echo $matches > 0 ? "$matches same point(s)": "no same points"; ?> 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -