Latest news
Home » PHP » PHP foreach loop key value

PHP foreach loop key value

PHP foreach loop key value

foreach($data  as $key => $value):
echo $key; echo $value;
endforeach;
Example:
<?php
foreach($this->universities as $key => $value):
if($key == $group->group_id):
echo $value;
endif;
endforeach;
?>

Leave a Reply

x

Check Also

How to print Codeigniter upload error

if you want to display errors on upload functionality in codeigniter. Use the following function ...