if(widgetStylesPrinted != true) {document.write('');}var widgetStylesPrinted = true;var content = '
Dynamic result binding to object
php
for($i=0;$i<count($keys);$i++) {
$params[] = &$row[$keys[$i]];
}
//bind results dynamically
call_user_func_array(array($stmt, 'bind_result'), $params);
 
while ($stmt->fetch()) { //fetch all records
foreach($row as $key => $val) //bind results to array
{
$c[$key] = $val;
}
//build a new object class
$class = new ReflectionClass(get_class($object));
$theobjects[] = $class->newInstanceArgs($c); //instantiate with parameters
}
';document.write(content);