View Single Post
Old 04-25-2009, 06:26 PM   #20 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Kalle View Post
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!
allworknoplay is offline  
Reply With Quote