RE: [PHP-DB] Brain not working, help needed :-). .
| From: | Norland, Martin | Date: | Mon, 29 Aug 2005 12:55:10 +0000 |
| Subject: | RE: [PHP-DB] Brain not working, help needed :-). . | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-40167@lists.php.net to get a copy of this message | ||
Figured I'd expand on what these evaluate to, in case anyone gets lost
otherwise:
>-----Original Message-----
>From: Micah Stevens [mailto:micah@raincross-tech.com]
[snip]
>You can use variable variables.. like this:
>
>$num = 2
$num == 2 [obviously :) ]
>$varname = "id".$num;
$varname == "id2"
>$$varname = "id2 is stored here!";
$id2 == "id2 is stored here!" // $$varname == ${$varname} == ${"id2"}
You can use {}'s whenever there's ambiguity, just like arrays. It's
true that these can get confusing, but they're also a really good way to
do some neat dynamic things and have predictable variable names for
them.
>It's in the docs in the variables section..
I couldn't have suggested a better place to get sorted out on all this -
Chris: browse the docs some, best way to wrap your head around things -
and the comments at the bottom tend to have useful real-world examples.
cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.