0

Is there a way I could access specific array elements below in php? I've tried these codes but none seems to work: 1) $array[0]['description'] 2) $array->description

array (size=5)   'question0' => 
    array (size=7)
      'description' => string 'Lorem ipsum' (length=11)
      'strCorrectResponse' => string 'Lorem ipsum;' (length=11)
      'strStatus' => string 'incorrect' (length=9)
      'strUserResponse' => string 'Lorem ipsum' (length=1)
      'nWeight' => string '1' (length=1)
      'nPoints' => string '0' (length=1)
      'nQuestionNumber' => string '1' (length=1)   'question1' => 
    array (size=7)
      'description' => string 'Lorem ipsum' (length=11)
      'strCorrectResponse' => string 'Lorem ipsum' (length=11)
      'strStatus' => string 'incorrect' (length=9)
      'strUserResponse' => string 'Lorem ipsum' (length=11)
      'nWeight' => string '1' (length=1)
      'nPoints' => string '0' (length=1)
      'nQuestionNumber' => string '2' (length=1)
Marc B
  • 356,200
  • 43
  • 426
  • 500
EDev
  • 3
  • 1

1 Answers1

2

Just follow the keys down the rabbit hole:

$arr = array ('question0' => array('description' => string 'Lorem ipsum' (length=11) 
  |                |                      |
$arr        ['question0']           ['description']
$arr['question0']['description'] => Lorem ipsum
Marc B
  • 356,200
  • 43
  • 426
  • 500