Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Loop through an Array without Using "foreach"
How To Loop through an Array without Using "foreach"? - PHP Script Tips - PHP Built-in Functions for Arrays
✍: FYIcenter.com
PHP offers the following functions to allow you loop through an array without using the "foreach" statement:
Here is a PHP script on how to loop through an array without using "foreach":
<?php
$array = array("Zero"=>"PHP", "One"=>"Perl", "Two"=>"Java");
print("Loop with each():\n");
reset($array);
while (list($key, $value) = each($array)) {
print("[$key] => $value\n");
}
print("\n");
print("Loop with current():\n");
reset($array);
while ($value = current($array)) {
print("$value\n");
next($array);
}
print("\n");
?>
This script will print:
Loop with each(): [Zero] => PHP [One] => Perl [Two] => Java Loop with current(): PHP Perl Java
2007-04-14, 5284👍, 0💬
Popular Posts:
What is the FP per day in your current company?
How to reduce the final size of an executable file? Size of the final execuatable can be reduced usi...
What are unadjusted function points and how is it calculated? Unadjusted function points = ILF + EIF...
What Is the Data Pump Import Utility? - Oracle DBA FAQ - Loading and Exporting Data Oracle Data Pump...
1. The basics first, please define the web in simple language? How is it connected with internet? Wh...