Variable reuse problem
| From: | Frank M. Kromann | Date: | Fri, 29 Sep 2006 17:45:48 +0000 |
| Subject: | Variable reuse problem | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-25896@lists.php.net to get a copy of this message | ||
Hello Everyone,
I have a small problem with the mssql extension and resources (Tested with
PHP 5.2).
If I use the same variable to store the resource for a result the second
result is not always correct!
// Example 1 does not work
$rs = mssql_query("select 1");
$rs = mssql_query("select 3 select 2 select 1");
// Example 2 works fine
$rs1 = mssql_query("select 1");
$rs2 = mssql_query("select 3 select 2 select 1");
// Example 3 works fine
$rs = mssql_query("select 1");
mssql_free_result($rs);
$rs = mssql_query("select 3 select 2 select 1");
// Example 4 works fine
$rs = mssql_query("select 1");
unset($rs);
$rs = mssql_query("select 3 select 2 select 1");
The registered destructor is called in all four situations.
So why is there a difference between asigning a new resource value to a
variable with and without the unset()?
- Frank