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, 4815👍, 0💬
Popular Posts:
What Is the Difference between Formal Parameters and Actual Parameters? - Oracle DBA FAQ - Creating ...
Explain simple Walk through of XmlReader ? In this section we will do a simple walkthrough of how to...
What is the difference between RegisterClientScriptBloc kand RegisterStartupScript? RegisterClientSc...
How was XML handled during COM times? During COM it was done by using MSXML 4.0. So old languages li...
If we have two version of same assembly in GAC how do we make a choice ? OK first let’s try to under...