Difference between revisions of "Array (PHP)"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Iterations)
(Iterations)
Line 11: Line 11:
 
Example using <code>while()</code>:
 
Example using <code>while()</code>:
  
<code><pre>
+
<pre>
 
<?php
 
<?php
 
     while (list($var, $val) = each($array)) {
 
     while (list($var, $val) = each($array)) {
Line 17: Line 17:
 
     }
 
     }
 
?>
 
?>
</pre></code>
+
</pre>
  
 
== See also ==  
 
== See also ==  

Revision as of 10:03, 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: