Linked Questions

Popular Questions

Using array values as another array keys

Asked by At

Good day everyone.

I have an regular array (this is the print_r result, the array can have from 1 to n positions):

    [1] => value1
    [2] => value2
    [3] => value3

I have another array defined elsewhere as:

$array_def['value1']['value2']['value3'] = array(
 'fl' => 'field1',
 'f2' => 'field2',

Using the first array result, how can i check if $array_def exists? In other words, i need to use a flat array values to check if a multidimensional array correspondence exists; keep in mind that the values can repeat in the first array, therefore flipping values with keys it's not an option as it will collide and remove duplicated values.

Thanks in advance.

Related Questions