Reputation: 1099
I have created an array in php that prints this
Array ( [mark] => Array ( [0] => 3 [1] => 4 ) )
How i can print the marks separately from the array. e.g just print out 3.
Upvotes: 3
Views: 9418
Reputation: 72652
$myArray = array('mark'=>array(3, 4));
You can print a specific element by using for example:
echo $myArray['mark'][0]; // this would print out 3
You could also loop through the array:
foreach($myArray['mark'] => $item) {
echo $item;
}
// this would result it the printing of 3 first and then 4
Upvotes: 1
Reputation: 1601
to print all values:
foreach($array as $value){
echo $value."<br />";
}
Upvotes: 1