3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Mother { /** @var array */ private static $inMemoryCache = array(); public function testMethod($param) { $cacheKey = '_'.$param; if (!isset(self::$inMemoryCache[$cacheKey])) { echo PHP_EOL, 'compute result', PHP_EOL; self::$inMemoryCache[$cacheKey] = $param * 2; } return self::$inMemoryCache[$cacheKey]; } } final class Daughter extends Mother { } final class Son extends Mother { } $d = new Daughter(); $s = new Son(); $d->testMethod(1); $d->testMethod(1); $s->testMethod(1); $s->testMethod(1);
Output for git.master_jit, git.master, rfc.property-hooks
compute result

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
64.83 ms | 401 KiB | 8 Q