• Hi,

    Please help me to extract certain contents from a multi dimensional array:

    var_dump($data); //now below is what this is var dumping

    array (size=1)
      'multi_select' =>
        array (size=2)
          'user_value' =>
            array (size=2)
              0 => string 'US' (length=2)
              1 => string 'VI' (length=2)
          'config' =>
            array (size=14)
              'section' => string 'no' (length=2)
              'sectitle' => string '' (length=0)
              'id' => string 'multi_select' (length=12)
              'label' => string 'Multi Select' (length=12)
              'type' => string 'selects' (length=7)
              'deflt' => string '' (length=0)
              'options' => string 'US|United States
    CA|Canada
    VI|Virgin Islands (U.S.)' (length=51)
              'expected' => string '' (length=0)
              'required' => string 'yes' (length=3)
              'levels' => string 'all' (length=3)
              'editable' => string 'yes' (length=3)
              'classes' => string '' (length=0)
              'styles' => string '' (length=0)
              'attrs' => string '' (length=0)

    Now I want to extract only the US and VI from these (and if anything extra, them also):

    0 => string 'US' (length=2)
    1 => string 'VI' (length=2)

    Please help me

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Something like this should work:

    ['multi_select']['user_value'][0] // Gets you a value of 'US'
    ['multi_select']['user_value'][1] // Gets you a value of 'VI'

Viewing 1 replies (of 1 total)

The topic ‘How to extract data from multi dimentional array’ is closed to new replies.