php - compare multi value with foreach -


regex

a=1 b=2 c=4 d=17 g=9 ... 

is function check if charecter , number same ....

    funnction compare($val1,$val2)     {      $val1=explode("|",$val1)     $val2=explode("|",$val2)      foreach(?) {     ???? }     } 

how can compare foreach want copare pair $val1[1] $val2[1] , if right return true

this example of call function

 compare ("g|d|a","7|11|12")     compare      g 7     d 11 .... 


what mean in copare pair $val1[1] $val2[1] , if right return true? why not use $val1===$val2 ?

you can use

$result=true; for($i=0; $i<count($val1);$i++){     $result = $result && ($val1[$i]==$val2[$i]); } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -