Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
class A {
public $pub = 1;
protected $prot = 2;
private $priv = 3;
}
$n = 10000000;
$a = new A;
$t = microtime(true);
for ($i = 0; $i < $n; $i++) {
$x = (array) $a;
}
var_dump(microtime(true) - $t);
$t = microtime(true);
for ($i = 0; $i < $n; $i++) {
$x = get_mangled_object_vars($a);
}
var_dump(microtime(true) - $t);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.