Re: variable hell

From: Date: Tue, 04 Jan 2005 19:09:32 +0000
Subject: Re: variable hell
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-205618@lists.php.net to get a copy of this message
On Tue, 2005-01-04 at 16:54 +0200, mario wrote: > Hi all > > I have few variables in this format: > > $isproductssorttext = "150"; > $isofferssorttext = "250"; > $isnewproductssorttext = "350"; > > $isproductscount = "50"; > $isofferscount = "30"; > $isnewproductscount = "20"; > etc.... > > > What I want to do is have a variable > e.g. $x = "products"; > > and create from that, the variable $is'products'sorttext > (<--$isproductssorttext) and use its value > > so if $x was "offers" on echo I would have (250) <-- "$isofferssorttext" > if $x was newproducts on echo I would have (350) <-- > "$isnewproductssorttext" > > Thanks in advance > > Mario > This seems like an odd approach to doing this.. but here goes: $isproducttext = "120"; $x = "product"; $y = "is" . $x . "text"; print $$y; -- /*************************************** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | robby@planetargon.com * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development * --- Now supporting PHP5 --- ****************************************/

« previous php.general (#205618) next »