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

Export Database using codeigniter

Database Utility Class : CodeIgniter PHP script to download mysql db-codeigniter,Backup MySQL database with CodeIgniter ...