3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public $bar; public function __construct($bar) { $this->bar = $bar; } public function getBar() { return $this->bar; } public function setBar($bar) { $this->bar = $bar; } } $foo = new Foo(42); Debug::ProcessingTimeSinceLastCall(); //Without Setter and Getter for ($i = 0; $i < 1000000; $i++) { if ($foo->bar === 42) { $foo->bar = 43; } else { $foo->bar = 42; } } Debug::ProcessingTimeSinceLastCall('No Setter and Getter'); //With Getter and Setter for ($i = 0; $i < 1000000; $i++) { if ($foo->getBar() === 42) { $foo->setBar(43); } else { $foo->setBar(42); } } Debug::ProcessingTimeSinceLastCall('With Setter and Getter');
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Class 'Debug' not found in /in/fea8Z:20 Stack trace: #0 {main} thrown in /in/fea8Z on line 20
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Fatal error: Class 'Debug' not found in /in/fea8Z on line 20
Process exited with code 255.