Learning syntax foreach ($client as $k=>$v) { } |
[eluser]Unknown[/eluser]
foreach ($client as $k=>$v) { } $client is an array now $k => $v ???
[eluser]Colin Williams[/eluser]
PHP has a User Guide too: http://us3.php.net/foreach
[eluser]thinkigniter[/eluser]
Let my shine some light on this. I found it confusing too. [quote author="a123bcd" date="1216475407"]foreach ($client as $k=>$v) { } $client is an array now $k => $v ???[/quote] $k == $key == $ID $v == $value == $NAME This is your array( '1' => 'some_name' , '2' => 'some_other_name' ); foreach ($client as $ID => $NAME) { echo '<p>client ID is: '. $ID . </p>; echo '<p>client Name is: '. $NAME . </p>; echo '<br />'; } results in... client ID is: 1 client Name is: some_name client ID is: 2 client Name is: some_other_name Does this help?
|
Welcome Guest, Not a member yet? Register Sign In |