Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php get array key like

//your array
    $arr1 = array (
           "y" => 35,
           "x" => 51,
           "z" => 35,
           "c_3" => 4,
           "c_1" => 54,
           "c_6" => 53,
           "c_9" => 52
    );
// Array with keys you want
    $arr2 =  array (
           "c_3" => '',
           "c_1" => '',
           "c_6" => '',
           "c_9" => ''
    );
//use array_intersect_key to find the common  ;)
    print_r(array_intersect_key($arr1,$arr2));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #array #key
ADD COMMENT
Topic
Name
1+8 =