Home » Programming » php » PHP for statement

PHP for statement

It is used when one knows how many time one need to run the particular loop. It is also of two types:
1. for
Loop back again and again through specified time duration.

Syntax:

Example:

Result:

The number is: 0
The number is: 1
The number is: 2
The number is: 3

2. foreach
For each elements in the array it give result.
It is used to iterate all the elements over array.
Syntax:

Example:

Result:
swift
alto
toyoto
I10


Leave a comment

Your email address will not be published.

Managed by MochaHost - Fast & Easy WordPress Hosting