Created
May 14, 2019 14:39
-
-
Save nikic/f592686c75d8d34d82ddc5900b598199 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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