PHP For Each Loop
PHP for each loop is used to traverse array elements.
Syntax
foreach( $array as $var ){
//code to be executed
}
?>
Example
<?php
$season=array("summer","winter","spring","autumn");
foreach( $season as $arr ){
echo "Season is: $arr<br />";
}
?>
PHP for each loop is used to traverse array elements.
Syntax
foreach( $array as $var ){
//code to be executed
}
?>
Example
<?php
$season=array("summer","winter","spring","autumn");
foreach( $season as $arr ){
echo "Season is: $arr<br />";
}
?>
No comments:
Post a Comment