Great Excess
Welcome to Great Excess arrow Website arrow php - website arrow PHP - Foreach Function Control
Wednesday, 20 August 2008
 
 
English Language
Bahasa Indonesia
Computer
Website
Gallery
Health
Ebook
Tips
Movies

Visitor Data
Your IP
38.103.63.59
United States United States :
Browser
Unknown Browser Unknown Browser
Operating System
Unknown Operating System Unknown Operating System

PHP - Foreach Function Control | Print |
 

PHP -  Foreach Function Control

A foreach loop is used to loop through an array. Here are both forms of the syntax:

foreach(array_expression as $value) {
statements
}

foreach(array_expression as $value):
statements
endforeach;

This loops through the array_expression and assigns each value of the array to $value in turn. You can also get the key for each element with this syntax:

foreach(array_expression as $key=>$value) {
statements
}

The break and continue statements work with a foreach loop like they do with a for loop.

 

This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 600
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

 
Top! Top!