Re: SQL Functions
| From: | raditha dissanayake | Date: | Tue, 10 Aug 2004 17:14:17 +0000 |
| Subject: | Re: SQL Functions | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-193326@lists.php.net to get a copy of this message | ||
John Nichel wrote:
John W. Holmes wrote:I'd say the main performance hit with this approach is that we need to (indirectly) iterate over the resultset twice. First we go into a loop to do the actual retrieval and chuck in into the array. Then we usually need to go into another loop to see what we have in the array. As you mentioned in your follow up mail the difference between array_push() and $array[]=.. is neglible similarly in most cases, looping twice will not have a significant impact - unless of course you are looping through a really large resultset and don't have a lot of memory to spare. -- Raditha Dissanayake. ------------------------------------------------------------------------ http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar.Change that to: $array = array(); $results = mysql_query( $sql, DB::connect() ); while($data = mysql_fetch_array($result)) { $array[] = $data; } return $array;Would there be any speed/performance issuse with using something like... array_push ( $array, $data ); vs. $array[] = $data;