Req #46977 [Fbk->NoF]: Extract() to work on data objects
| From: | php-bugs at lists dot php dot net | Date: | Tue, 30 Dec 2014 10:41:30 +0000 |
| Subject: | Req #46977 [Fbk->NoF]: Extract() to work on data objects | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189382@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46977&edit=1
ID: 46977
Updated by: php-bugs@lists.php.net
Reported by: michael at calwell-computing dot co dot uk
Summary: Extract() to work on data objects
-Status: Feedback
+Status: No Feedback
Type: Feature/Change Request
Package: *General Issues
Operating System: All
PHP Version: 5.3.0alpha3
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2014-04-16 22:57:03] levim@php.net
Given the simple work-around is this something you are interested in pursuing farther?
------------------------------------------------------------------------
[2012-02-25 02:20:41] james dot cohen at gmail dot com
You could get the behaviour that you want with:
extract(get_object_vars($carl), EXTR_PREFIX_ALL, 'carl');
if that helps
------------------------------------------------------------------------
[2008-12-30 20:54:52] michael at calwell-computing dot co dot uk
Description:
------------
extract() currently only extracts arrays into variables.
I think it would be good to be able to extract data objects too.
Reproduce code:
---------------
e.g.
$car1->wheels = 4;
$car1->horsepower = 40;
$car1->seats = 2;
extract($car1, EXTR_PREFIX_ALL, 'car1');
/*
$car1_wheels = 4
$car1_horsepower = 40
...
*/
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=46977&edit=1