Re: Need an explination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$row is an array containing a key and a value for each
array item. The code from the book is going to loop
through each element in the array and it breaks the
key and value into seperate variables called $col and
$val.  Basically you are accessing array $row[$col] =
$val but for each element in the array. Example
$array =
array("Name"=>"Jon","Age"=>"29","Sex"=>"male")
foreach ($array as $col=>$val){
print("$col:$val\n");
}
Would print
Name:Jon
Age:29
Sex:male

Hope that makes sense

Jon
--- teacherweeks <teacherweeks@xxxxxxxxx> wrote:

> I am having trouble understanding this piece of code
> from the book I 
> am learning from... I was wondering if someone could
> explain it in 
> complete idiot terms... 
> 
> foreach($row as $col => $val)
> 
> Thanks
> 
> Big W
> 
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux