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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: brianauton at eVerian dot com
New email:
PHP Version: OS:

 

 [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: Mon Apr 29 08:01:29 2024 UTC