3v4l.org

run code in 500+ PHP versions simultaneously
<?php // storage class, PHP 8.3 needed class LazyValue { public function __construct(private Closure $lazy){} public function getValue() { static $value = ($this->lazy)(); return $value; } } // use $l1 = new LazyValue(function () { echo "slow\n"; return "42\n"; }); echo $l1->getValue(); echo $l1->getValue(); echo $l1->getValue();

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)
8.5.90.0110.00616.92
8.5.80.0310.00816.72
8.5.70.0340.00716.47
8.5.60.0400.00616.86
8.5.50.0320.00316.42
8.5.40.0180.00516.51
8.5.30.0300.00516.54
8.5.20.0330.00816.62
8.5.10.0350.00616.35
8.5.00.0100.00816.55
8.4.240.0330.00919.39
8.4.230.0280.01119.34
8.4.220.0320.01119.45
8.4.210.0320.01019.59
8.4.200.0340.00819.30
8.4.190.0350.01319.36
8.4.180.0290.00819.73
8.4.170.0320.00919.59
8.4.160.0320.01019.73
8.4.150.0310.01019.62
8.4.140.0340.00717.78
8.4.130.0280.01017.47
8.4.120.0320.01017.73
8.4.110.0380.00817.82
8.4.100.0330.01017.65
8.4.90.0370.00817.52
8.4.80.0320.01217.69
8.4.70.0360.00717.67
8.4.60.0330.01017.57
8.4.50.0310.01117.87
8.4.40.0360.00817.58
8.4.30.0350.00917.64
8.4.20.0330.00817.59
8.4.10.0310.01317.42
8.3.330.0370.01118.28
8.3.320.0330.00818.24
8.3.310.0370.01118.16
8.3.300.0310.01418.05
8.3.290.0360.00718.20
8.3.280.0300.01018.04
8.3.270.0360.01216.68
8.3.260.0360.01116.58
8.3.250.0140.00716.61
8.3.240.0150.00416.77
8.3.230.0200.00716.73
8.3.220.0330.00816.72
8.3.210.0320.00916.50
8.3.200.0270.01016.73
8.3.190.0360.00716.68
8.3.180.0300.00716.73
8.3.170.0350.00516.77
8.3.160.0330.01216.43
8.3.150.0330.00616.46
8.3.140.0340.00916.49
8.3.130.0280.01016.61
8.3.120.0250.00916.45
8.3.110.0270.01016.27
8.3.100.0320.01116.31
8.3.90.0350.00816.58
8.3.80.0310.01116.48
8.3.70.0380.00716.60
8.3.60.0350.00716.46
8.3.50.0350.00816.60
8.3.40.0290.00917.98
8.3.30.0290.00717.75
8.3.20.0280.00917.81
8.3.10.0280.00917.98
8.3.00.0300.00917.63
8.2.330.0460.00717.89
8.2.320.0320.01117.55
8.2.310.0280.01317.75

preferences:
49.98 ms | 778 KiB | 5 Q