Difference between revisions of "Array (PHP)"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Description)
Line 4: Line 4:
  
 
...
 
...
 +
 +
== Iterations ==
 +
 +
You can iterate through arrays in various ways.
 +
 +
Example using <code>while()</code>:
 +
 +
<code>
 +
<?php
 +
    while (list($var, $val) = each($array)) {
 +
        print "$var is $val\n";
 +
    }
 +
?>
 +
</code>
  
 
== See also ==  
 
== See also ==  

Revision as of 10:02, 27 October 2015

This article describes arrays in PHP.

Description

...

Iterations

You can iterate through arrays in various ways.

Example using while():

<?php

   while (list($var, $val) = each($array)) {
       print "$var is $val\n";
   }

?>

See also

External links

Iteration: