Skip to content

Instantly share code, notes, and snippets.

View olvlvl's full-sized avatar

Olivier Laviale olvlvl

View GitHub Profile
@olvlvl
olvlvl / instantiate.php
Created August 23, 2011 22:33
Create an instance in the same fashion as PDO with the FETCH_CLASS mode
<?php
function instantiate($class_name, array $properties=array(), array $construct_args=array())
{
$class_reflection = new \ReflectionClass($class_name);
$properties_count = 0;
$serialized = '';
if ($properties)
{