Difference between revisions of "Array (PHP)"

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

<code>
<?php
    while (list($var, $val) = each($array)) {
        print "$var is $val\n";
    }
?>
</code>

See also

External links

Iteration: