3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface PolicyRule { public function isSatisfiedBy(); } abstract class EnforcedRule implements PolicyRule { const TYPE_NO = 'No'; const TYPE_YES = 'Yes'; protected $enforcementType; protected function isEnforced() { return ($this->enforcementType == self::TYPE_YES); } protected function guardEnforcementType($aType) { if (! in_array($aType, [self::TYPE_NO, self::TYPE_YES])) { throw new InvalidEnforcementTypeException($aType); } } } abstract class MinimumCharacterCountRule extends EnforcedRule { const DEFAULT_MINIMUM = 1; protected $regexPattern; protected $minimumCount = self::DEFAULT_MINIMUM; public function isSatisfiedBy($aValue) { if (! $this->isEnforced()) { return true; } $matches = []; preg_match_all($this->regexPattern, $aValue, $matches); return (count($matches[0]) >= $this->minimumCount); } } class NumericRule extends MinimumCharacterCountRule { protected $regexPattern = '/[0-9]/'; public function __construct($aMinimumCount = self::DEFAULT_MINIMUM) { $this->minimumCount = $aMinimumCount; } } class SpecialCharacterRule extends MinimumCharacterCountRule { protected $regexPattern = '/[~`#\$%\^&\*\(\)\-_\+\|,\.<>]/'; public function __construct($aMinimumCount = self::DEFAULT_MINIMUM) { $this->minimumCount = $aMinimumCount; } } $numeric = new NumericRule(); var_dump($numeric->isSatisfiedBy("for5"));

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.3.60.0090.00616.75
8.3.50.0030.01218.14
8.3.40.0080.00818.67
8.3.30.0140.00718.71
8.3.20.0030.00520.39
8.3.10.0080.00023.66
8.3.00.0080.00019.26
8.2.180.0090.00616.63
8.2.170.0120.00322.96
8.2.160.0100.00320.52
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0090.00017.50
8.2.120.0000.00826.35
8.2.110.0000.00820.47
8.2.100.0090.00317.91
8.2.90.0040.00419.22
8.2.80.0040.00417.97
8.2.70.0000.00817.63
8.2.60.0080.00017.68
8.2.50.0030.00618.07
8.2.40.0080.00019.35
8.2.30.0000.00720.67
8.2.20.0040.00417.73
8.2.10.0040.00418.03
8.2.00.0000.00718.00
8.1.280.0180.00325.92
8.1.270.0100.00023.96
8.1.260.0080.00028.09
8.1.250.0060.00328.09
8.1.240.0000.00923.82
8.1.230.0000.01117.52
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0040.00417.12
8.1.190.0060.00317.70
8.1.180.0080.00018.10
8.1.170.0030.00618.53
8.1.160.0040.00421.98
8.1.150.0000.00818.92
8.1.140.0050.00319.61
8.1.130.0030.00617.61
8.1.120.0040.00417.41
8.1.110.0070.00017.43
8.1.100.0020.00517.42
8.1.90.0040.00417.48
8.1.80.0000.00717.39
8.1.70.0030.00317.43
8.1.60.0040.00417.63
8.1.50.0030.00517.34
8.1.40.0000.00817.47
8.1.30.0050.00317.51
8.1.20.0030.00617.43
8.1.10.0040.00417.34
8.1.00.0000.00817.33
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0000.00718.54
8.0.270.0030.00317.23
8.0.260.0030.00317.17
8.0.250.0000.00716.94
8.0.240.0060.00317.01
8.0.230.0030.00317.04
8.0.220.0030.00316.93
8.0.210.0040.00416.80
8.0.200.0030.00316.94
8.0.190.0070.00016.91
8.0.180.0030.00616.96
8.0.170.0000.00716.83
8.0.160.0000.00716.88
8.0.150.0000.00816.90
8.0.140.0000.00716.87
8.0.130.0060.00013.32
8.0.120.0000.00816.80
8.0.110.0040.00416.85
8.0.100.0070.00016.96
8.0.90.0000.00816.84
8.0.80.0070.01016.90
8.0.70.0040.00416.81
8.0.60.0040.00416.89
8.0.50.0000.00716.93
8.0.30.0080.01016.99
8.0.20.0130.00517.40
8.0.10.0040.00416.87
8.0.00.0060.01116.71
7.4.330.0000.00616.84
7.4.320.0000.00716.50
7.4.300.0060.00016.64
7.4.290.0080.00016.41
7.4.280.0060.00316.52
7.4.270.0000.00616.63
7.4.260.0030.00316.46
7.4.250.0030.00716.50
7.4.240.0040.00316.53
7.4.230.0030.00316.43
7.4.220.0030.01416.60
7.4.210.0000.01416.38
7.4.200.0000.00716.32
7.4.160.0130.00416.45
7.4.150.0140.00317.40
7.4.140.0140.00617.86
7.4.130.0110.00916.52
7.4.120.0100.00816.41
7.4.110.0030.01516.56
7.4.100.0120.00616.59
7.4.90.0110.00616.50
7.4.80.0160.00619.39
7.4.70.0040.01216.57
7.4.60.0120.00316.61
7.4.50.0130.00016.26
7.4.40.0040.01216.37
7.4.30.0060.01216.49
7.4.00.0030.01014.79
7.3.330.0040.00213.29
7.3.320.0000.00613.41
7.3.310.0050.00216.29
7.3.300.0000.00716.18
7.3.290.0080.00816.35
7.3.280.0100.00816.32
7.3.270.0180.00617.40
7.3.260.0100.00716.32
7.3.250.0050.01416.39
7.3.240.0120.00716.33
7.3.230.0120.00916.39
7.3.210.0090.00816.39
7.3.200.0130.01016.66
7.3.190.0090.01216.35
7.3.180.0100.00716.39
7.3.170.0160.00316.55
7.3.160.0120.01116.55
7.2.330.0080.01116.34
7.2.320.0170.00316.62
7.2.310.0040.01416.42
7.2.300.0090.00916.43
7.2.290.0140.00716.61
7.2.60.0030.00916.55
7.2.00.0060.00919.30
7.1.200.0030.01015.23
7.1.100.0040.00817.89
7.1.70.0080.00316.83
7.1.60.0120.01219.36
7.1.50.0030.01616.54
7.1.00.0070.07322.32
7.0.200.0040.00416.68
7.0.60.0030.04019.89
7.0.50.0030.08717.91
7.0.40.0070.08320.02
7.0.30.0270.05720.24
7.0.20.0200.04720.05
7.0.10.0030.07320.26
7.0.00.0030.06020.30
5.6.280.0100.04020.94
5.6.210.0070.08320.59
5.6.200.0030.09318.19
5.6.190.0070.04020.46
5.6.180.0500.07720.41
5.6.170.0200.05320.51
5.6.160.0100.07720.48
5.6.150.0130.07318.27
5.6.140.0070.06718.27
5.6.130.0030.08318.27
5.6.120.0170.06021.00
5.6.110.0100.08321.13
5.6.100.0170.07021.00
5.6.90.0230.07021.10
5.6.80.0070.08020.37
5.5.350.0230.07720.48
5.5.340.0100.07017.99
5.5.330.0070.07720.31
5.5.320.0000.05720.31
5.5.310.0270.07320.31
5.5.300.0070.04017.97
5.5.290.0100.04717.93
5.5.280.0130.05020.91
5.5.270.0070.04320.64
5.5.260.0170.06320.69
5.5.250.0130.08320.60
5.5.240.0230.07320.19

preferences:
47.21 ms | 400 KiB | 5 Q