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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu May 08 07:01:27 2025 UTC