04-25-2009, 06:26 PM
|
#20 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by Kalle
This one is similar to foreach, except its written the other way around:
javascript Code:
for(c in ['Hello', 'World']) { alert(c); }
Arrays or objects to iterate are set on the right side, unlike foreach in PHP where its on the left side. The following example would looks like this in php:
PHP Code:
foreach(Array('Hello', 'World') as $c)
{
echo($c);
}
|
You are a lifesaver!
|
|
|
|