Req #10546 [Csd->Sus]: extract() to work with objects

From: Date: Sat, 06 Aug 2016 09:35:07 +0000
Subject: Req #10546 [Csd->Sus]: extract() to work with objects
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202995@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=10546&edit=1 ID: 10546 Updated by: nikic@php.net Reported by: fabiankessler at usa dot net Summary: extract() to work with objects -Status: Closed +Status: Suspended Type: Feature/Change Request Package: Class/Object related Operating System: * PHP Version: * Assigned To: kalle Block user comment: N Private report: N New Comment: By convention "Suspended" is our "Needs RFC" state. Previous Comments: ------------------------------------------------------------------------ [2016-08-06 00:31:01] kalle@php.net I'm gonna close this, such a feature would need a healthy discussion on the mailing list which most likely will end in an RFC. All in all I'm not a huge fan of this, but every idea deserves a chance ------------------------------------------------------------------------ [2014-08-19 16:11:03] levim@php.net Related To: Bug #26545 ------------------------------------------------------------------------ [2013-09-19 23:03:14] metamarkers at gmail dot com A blind import into an object would be neat for shortcutting certain things, but would undermine __set(). Consider instead: function import ( $object , array $vars ) { foreach ($vars as $k=>$v) { $object->$k = $v; } } ------------------------------------------------------------------------ [2001-04-29 01:06:34] fabiankessler at usa dot net example: class foo { function foo() { $var_array = array('hello'=>'world'); extract($var_array, EXTR_PREFIX_ALL, "this->prefix"); echo $this->prefix_hello; } }; $f = new foo(); :) fab ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=10546&edit=1

« previous php.bugs (#202995) next »