3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Blend\Model; use SebastianBergmann\Money\Money; final abstract class MoneyFactory { public static function __callstatic($meth, array $args) { $meth = strtoupper($meth); if (!self::isValidCurrency($meth)) { throw new InvalidArgumentException("Unknown currency"); } if (!isset($args[0])) { throw new InvalidArgumentException("Missing amount"); } return new Money($args[0] * 100, new Currency($meth)); } private static function isValidCurrency($currency) { if (strlen($currency) != 3) { return false; } try { new Currency($currency); } catch (InvalidArgumentException $e) { return false; } return true; } }

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.2300.04319.01
5.4.190.2400.04018.97
5.4.180.2170.04019.07
5.4.170.2270.05019.18
5.4.160.2570.03319.05
5.4.150.2000.04718.97
5.4.140.2600.03016.39
5.4.130.2200.03316.41
5.4.120.2170.03716.51
5.4.110.2400.03716.54
5.4.100.2170.03716.56
5.4.90.2100.04016.24
5.4.80.2070.05016.49
5.4.70.2430.04316.44
5.4.60.2470.03716.51
5.4.50.2070.04016.36
5.4.40.1900.04716.49
5.4.30.2530.04016.54
5.4.20.2430.03716.25
5.4.10.1870.04316.50
5.4.00.2200.03715.80
5.3.270.2300.03714.44
5.3.260.2370.05014.55
5.3.250.1770.04314.45
5.3.240.1730.03314.54
5.3.230.2370.05014.46
5.3.220.2030.03714.47
5.3.210.1970.04314.47
5.3.200.2230.03714.58
5.3.190.2230.04014.62
5.3.180.1970.03714.41
5.3.170.2400.03014.51
5.3.160.2170.04014.41
5.3.150.1830.03714.43
5.3.140.2130.04014.46
5.3.130.2000.05314.46
5.3.120.2230.03314.39
5.3.110.2130.04014.39
5.3.100.1470.03713.88
5.3.90.2170.04014.01
5.3.80.2470.02313.86
5.3.70.2230.03313.81
5.3.60.2300.02314.02
5.3.50.1730.03313.96
5.3.40.2230.03313.89
5.3.30.1630.04013.76
5.3.20.2030.02713.66
5.3.10.1970.03313.49
5.3.00.2200.03713.41

preferences:
136.59 ms | 1394 KiB | 7 Q