RE: Need an explination

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

 



> Just to make sure I got your explanation right.
>
> $row is the array name
> $col is the key and it is say that each column is a separate part of the
> array $val is each of the values when $col is evaluated to be true?
>
> am I right in this understanding?
>

take a look at http://php.net/manual/en/language.types.array.php

An array in PHP is actually an ordered map. A map is a type that maps
values to keys. This type is optimized in several ways, so you can use it
as a real array, or a list (vector), hashtable (which is an implementation
of a map), dictionary, collection, stack, queue and probably more.

and at: http://php.net/manual/en/control-structures.foreach.php
This simply gives an easy way to iterate over arrays. foreach works only
on arrays, and will issue an error when you try to use it on a variable
with a different data type or an uninitialized variable.

as simple as possible:

$array_var = array("Name"=>"Jon","Age"=>"29","Sex"=>"male")
foreach ($array_var as $key => $value) {
}

gets:
$key = "Name" and $value="Jon" for first iteration.
$key = "Age" and $value="29" for second iteration.
$key = "Sex" and $value="Male" for third iteration.


BUT, in PHP5 ypu can do a foreach on an object

-- 
José Miguel Santibáñez
    jms@xxxxxxxxx


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