3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo{ public static $myvar = 99; public $myvar = 77; public function __construct(){ $this->myvar = 35; } public function printMyVar(){ echo '->printMyVar(): '.$this->myvar; } public function setMyVar($mv){ $this->myvar = $mv; } } echo 'foo::$myvar: '.foo::$myvar."\n"; $foo = new foo(); echo $foo->printMyVar(); echo "\n"; echo 'foo::$myvar: '.foo::$myvar."\n"; echo "Conclusion: when using \$this-> to change the value, it adds another non-static version rather than changing the static version";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.200.0060.03812.39
5.4.190.0200.03812.36
5.4.180.0120.04712.36
5.4.170.0170.04112.38
5.4.160.0150.04512.37
5.4.150.0250.06612.36
5.4.140.0180.04112.05
5.4.130.0170.04012.04
5.4.120.0170.04111.99
5.4.110.0140.04311.99
5.4.100.0200.04011.99
5.4.90.0260.09611.99
5.4.80.0200.04111.99
5.4.70.0230.03911.98
5.4.60.0190.04311.98
5.4.50.0140.04711.99
5.4.40.0170.03911.97
5.4.30.0170.04111.97
5.4.20.0180.04111.97
5.4.10.0140.04511.97
5.4.00.0180.04411.46
5.3.270.0170.04712.73
5.3.260.0180.07112.72
5.3.250.0140.04512.71
5.3.240.0180.04212.72
5.3.230.0210.04012.71
5.3.220.0180.04012.68
5.3.210.0160.04312.68
5.3.200.0200.06912.68
5.3.190.0170.04312.68
5.3.180.0120.04712.68
5.3.170.0160.04212.67
5.3.160.0170.04212.68
5.3.150.0150.04312.67
5.3.140.0190.04012.66
5.3.130.0110.04912.65
5.3.120.0450.07812.66
5.3.110.0160.04412.66
5.3.100.0150.04412.11
5.3.90.0150.04212.08
5.3.80.0160.04512.07
5.3.70.0180.04212.08
5.3.60.0200.04112.06
5.3.50.0150.04412.00
5.3.40.0190.04112.00
5.3.30.0150.04311.96
5.3.20.0110.05111.74
5.3.10.0200.06711.70
5.3.00.0210.03511.68

preferences:
141.71 ms | 1394 KiB | 7 Q