note 37491 added to function.extract

From: Date: Mon, 17 Nov 2003 18:06:21 +0000
Subject: note 37491 added to function.extract
Groups: php.notes 
Request: Send a blank email to php-notes+get-60493@lists.php.net to get a copy of this message
Is there any way to use this function to extract variables into an object? Ie.. class A { var $a; var $b; function A($id) { $r = mysql_query("SELECT a,b FROM TABLE WHERE id='$id'"); $s = mysql_fetch_assoc($r); extract($s, PREFIX_ALL, '$this->'); } } I know this code probably won't work, but any suggestions on working around this normally time wasting activity would be great! Thanks ---- Manual Page -- http://www.php.net/manual/en/function.extract.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37491 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37491&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37491&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60493) next »