Edit report at https://bugs.php.net/bug.php?id=10546&edit=1

 ID:                 10546
 Comment by:         metamarkers at gmail dot com
 Reported by:        fabiankessler at usa dot net
 Summary:            extract() to work with objects
 Status:             Assigned
 Type:               Feature/Change Request
 Package:            Class/Object related
 Operating System:   *
 PHP Version:        *
 Assigned To:        andrei
 Block user comment: N
 Private report:     N

 New Comment:

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;
    }
}


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to