Skip to content

Instantly share code, notes, and snippets.

@danabrey
Last active March 1, 2018 12:52
Show Gist options
  • Save danabrey/3db4877ed9f36550d99ca640c1660aad to your computer and use it in GitHub Desktop.
Save danabrey/3db4877ed9f36550d99ca640c1660aad to your computer and use it in GitHub Desktop.
<?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