This question already has an answer here:
I know its easy but unfortunately I'm stuck in it. I've a array like this:-
Array
(
[0] => Array
(
[id] => 91
[title] => final test sql question
[description] =>
final test sql questions
[status] => 1
[testId] => 29
[questionOrderNo] => 1
[createdAt] => 2015-09-05 11:02:06
[updatedAt] => 0000-00-00 00:00:00
)
)
How can i read its value like id and title...
</div>
That is a multidimensional array you can access it through its index. i.e array[numeric index][text reference]
$myarr = array(
0 => array(
'id' => '91',
'title' => 'final test sql question',
'description' => 'final test sql questions',
'status' => '1',
'testId' => '29',
'questionOrderNo' => '1',
'createdAt' => '2015-09-05 11:02:06',
'updatedAt' => '0000-00-00 00:00:00'
)
);
echo $myarr[0]['status'];
You can access it by:
echo $yourArray[0]['id'];
echo $yourArray[0]['title'];
If you want to access all values use 'foreach'
foreach($yourArray as $key => $val)
{
echo $val['id'];
echo $val['title'];
}
$id = $arr[0]['id']; and if they are many of those all you have to do is foreach($bigarr as $arr){ echo $arr['id']; }