Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP: get keys of independent arrays
    primarykey
    data
    text
    <p>I have two arrays.</p> <p>Example of the first array:</p> <pre> $arrayOne = array ( 'fruit' => array( 'apples' => array(), 'oranges' => array(), 'bananas' => array() ), 'vegetables' => array( 'tomatoes' => array(), 'carrots' => array(), 'celery' => array(), 'beets' => array ( 'bears' => array(), 'battlestar-galactica' => array() ), ), 'meat' => array(), 'other' => array() ); </pre> <p>2nd:</p> <pre> $arrayTwo = array ( 'frewt' => array( 'aplz' => array(), 'orangeez' => array(), 'bunanahs' => array() ), 'vetchteblz' => array( 'toem8ohs' => array(), 'careodds' => array(), 'sell-R-e' => array(), 'beats' => array ( 'bare z' => array(), 'tablestar-neglectia' => array() ), ), 'neat' => array(), 'mother' => array() ); </pre> <p>Notice that the two arrays are in the exact same "format" (same number of dimensions, number of keys, order, etc., etc.), only the names of the keys differ. (The array keys basically hold all the data.)</p> <p>I have a few variables that address the keys of the first array (<code>$arrayOne</code>). E.g. <code>$one</code> would address the first dimension of the first array, so it's value (string) would be one out of <code>'fruit'</code>, <code>'vegetables'</code>, <code>'meat'</code> or <code>'other'</code>.<br> <code>$two</code> would be <code>'apples'</code> or <code>'oranges'</code> or <code>'bananas'</code> or <code>'tomatoes'</code> or <code>'carrots'</code>, etc., you get the idea. (There's vars for each dimension)<br> As I said, those variables only address <code>$arrayOne</code>. I want to be able to address the keys in the second array too, though. Meaning, by looking at the value of <code>$one</code> I want to be able to get the array_key of both arrays.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload