note 68761 rejected from function.mysql-fetch-array by betz

From: Date: Wed, 09 Aug 2006 22:56:36 +0000
Subject: note 68761 rejected from function.mysql-fetch-array by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-115741@lists.php.net to get a copy of this message
Note Submitter: spinningvertex at gmail dot com ---- Does anyone know how clever PHP is at memory handeling? "Performance: An important thing to note is that using mysql_fetch_array() is not significantly slower than using mysql_fetch_row(), while it provides a significant added value." In a loop such as this: <?php while($Row = mysql_fetch_array($ResID)) { // Do some stuff } ?> The memory needed for the field names should be freed each time the $Row gets re-assigned. However in a loop such as this: <?php $i = 0; $Row = array(); while($Row[$i] = mysql_fetch_array($ResID)) { $i++ } ?> Where the field names are stored in each $Row[$i]. Is the field names just assigned a reference (or pointer, if you wish) to the actual field name? Or does each $Row[$i] contain a copy of all the field names? In Delphi they call it "copy on demand", when multiple seeming unique blocks of memory share memory as long as they are all the same. So, does PHP do this? And if so, I assume it is ok to fetch thousands of rows with their fieldnames and keep them all in memory at once?

« previous php.notes (#115741) next »