Want to use value of a particular Key in a Multidimensional array In PHP -


my array this:

$x= array(  [0] => array     (         [0] => id         [1] => 15         [2] => 0     )  [1] => array     (         [0] =>names         [1] => 5         [2] => 1     ) ) 

i want write statement says if value of key[0]== id, something; else if value of key[0]== names, else.
there way can that?
thanks.

use foreach loop

    foreach($x $key){            if ($key[0] == 'id') {                 echo "your id code here";            } else if ($key[0] == 'names') {                 echo "your names code here";            }         }   

Comments