Re: Re: dynamically naming PHP vars on the fly?

From: Date: Sat, 08 Aug 2009 12:52:42 +0000
Subject: Re: Re: dynamically naming PHP vars on the fly?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-296468@lists.php.net to get a copy of this message
On Thu, 6 Aug 2009 12:42:49 -0600, Govinda wrote: >> Others have mentioned variable variables. While I have >> used those, I tend to prefer arrays: > > ah, yes, I see that too, now. Thanks for reminding me about arrays. > (You must be quite adept at arrays. ) I don't know, but I often stuff things into array, such as the following snippet: ... while ($r = mysql_fetch_row ($res)) { $news_paged[$page][$r[0]]['short_desc'] = $r[1]; if (isset ($r[2])) $news_paged[$page][$r[0]]['long_desc'] = $r[2]; ... I wonder if there's a noticable difference in performance between variable variables and arrays... I'm guessing it's small enough to be of no concern. > (And to give you credit Nisse, I ended up going with your solution > ('knock on wood'.. it is not all done yet) from the other php-db list > (building an array from data returned from the 3 union all selects- > query).) I'm a total newbie when it comes to SQL beyond simple SELECTs. If there's a noticable gain to be made from limiting the number of rows returned from the database, then that is probably worth persuing. Otherwise, I'd do it in PHP. /Nisse

« previous php.general (#296468) next »