Last active
March 1, 2018 12:52
-
-
Save danabrey/3db4877ed9f36550d99ca640c1660aad 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 Car { | |
private $color = "red"; | |
public function getColor() | |
{ | |
return $this->color; | |
} | |
} | |
$start_time = microtime(TRUE); | |
$car = new Car(); | |
$color = $car->getColor(); | |
for ($i = 0; $i < 1000000; $i++) { | |
$myvar = $color; | |
} | |
$end_time = microtime(TRUE); | |
var_dump($end_time - $start_time); | |
// 0.18557000160217 | |
// 0.16199398040771 | |
// 0.20022702217102 | |
// 0.15710806846619 | |
// 0.19765686988831 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment