Skip to content

Instantly share code, notes, and snippets.

@avinash2
Created February 25, 2011 08:21
Show Gist options
  • Save avinash2/843519 to your computer and use it in GitHub Desktop.
Save avinash2/843519 to your computer and use it in GitHub Desktop.
Outputting values stored in an array
<?php
$blog = array(
'title' => 'My Blog',
'author' => 'Avinash',
'pages' => array('about','services','folio','contact'),
);
// Using the 'foreach' construct to output key => value pairs stored in an array
foreach ($blog as $property => $value) {
echo $property . " : " . $value . "<br />";
};
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment