Looping Through an Associative Array with foreach : Associative Array : Data Structure PHP Source Code


PHP Source Code » Data Structure » Associative Array »

 

Looping Through an Associative Array with foreach



<html>
<head>
<title>Looping Through an Associative Array with foreach</title>
</head>
<body>
<?php
$character = array (name=>"Joe",
                    occupation=>"Programmer",
                    age=>30,
                    "Learned language "=>"Java"
);
foreach $character as $key=>$val ){
    print "$key = $val<br>";
}
?>
</body>
</html>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Data Structure
» Associative Array