|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-04-29 01:06 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 04:00:01 2025 UTC |
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; } }