php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9800 Suggestion for "extract" function
Submitted: 2001-03-16 19:11 UTC Modified: 2001-03-16 19:31 UTC
From: brianauton at eVerian dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS: Linux 2.2 (glibc 2.1)
Private report: No CVE-ID: None
 [2001-03-16 19:11 UTC] brianauton at eVerian dot com
The extract() function is a big help, but it would be even better if it returned some information about whether it assigned any variables, rather than just returning NULL.  What I really want is for the following code:

while($row = mysql_fetch_array($result)) {
  extract($row);
  //do something with the variables
}

to become this:

while(extract(mysql_fetch_array($result)))
  //do something with the variables

This would be possible if extract() returned any of the following:
  -0 or 1 to indicate whether any variables were assigned
  -the number of variables assigned
  -or even the array it was given in the first place

Just a thought...
Brian

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-16 19:31 UTC] jason@php.net
This feature has already been implemented in
CVS a few weeks ago(returns the number of elements inserted into the symbol table), and will be available
in 4.0.5 shortly.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC