3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* what I want to achieve*/ $rules= [ 'title' => 'required|min:2|max:5', ]; /////////////////////////////////////////// $types = ['min' => 2, 'max' => 5, 'required'=> 1]; function noValue(array $types):? string{ foreach($types as $key=>$value) { if($key === 'required' ||$value > 0){ return 'required'; } } return null; } function ruleTypes(array $types){ $arr = []; foreach($types as $key => $value) { $arr[] = noValue($types) ? $key . ':' . $value : 'hello'; } return implode('|', $arr); } $arrayOfRules = [ 'title' => ruleTypes($types), ]; var_dump($arrayOfRules);

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.0140.00718.43
8.3.50.0110.00718.45
8.3.40.0160.00318.63
8.3.30.0040.01118.85
8.3.20.0040.00418.63
8.3.10.0060.00321.89
8.3.00.0070.00021.73
8.2.180.0140.01025.92
8.2.170.0120.00318.96
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0000.00819.77
8.2.120.0000.00826.35
8.2.110.0060.00620.95
8.2.100.0120.00417.71
8.2.90.0030.00517.75
8.2.80.0030.00617.97
8.2.70.0040.00418.05
8.2.60.0070.00018.16
8.2.50.0030.00518.10
8.2.40.0000.00819.29
8.2.30.0040.00420.71
8.2.20.0050.00218.12
8.2.10.0000.00718.01
8.2.00.0000.00819.33
8.1.280.0140.00725.92
8.1.270.0040.00424.66
8.1.260.0050.00326.35
8.1.250.0100.00028.09
8.1.240.0030.00622.47
8.1.230.0000.01117.83
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0040.00417.10
8.1.180.0080.00018.10
8.1.170.0090.00018.59
8.1.160.0080.00018.82
8.1.150.0100.00018.93
8.1.140.0000.00718.90
8.1.130.0040.00417.33
8.1.120.0000.00817.36
8.1.110.0070.00017.43
8.1.100.0040.00417.53
8.1.90.0080.00017.48
8.1.80.0000.00717.37
8.1.70.0050.00317.45
8.1.60.0000.00817.59
8.1.50.0040.00417.59
8.1.40.0050.00217.52
8.1.30.0060.00317.61
8.1.20.0080.00017.70
8.1.10.0040.00417.47
8.1.00.0060.00317.54
8.0.300.0080.00018.77
8.0.290.0000.01016.75
8.0.280.0030.00318.38
8.0.270.0030.00317.19
8.0.260.0100.00016.82
8.0.250.0070.00016.95
8.0.240.0040.00416.97
8.0.230.0070.00016.96
8.0.220.0030.00316.87
8.0.210.0050.00216.93
8.0.200.0060.00016.83
8.0.190.0040.00416.95
8.0.180.0000.00916.94
8.0.170.0040.00416.92
8.0.160.0070.00016.86
8.0.150.0000.00716.92
8.0.140.0040.00316.91
8.0.130.0050.00313.25
8.0.120.0040.00416.85
8.0.110.0040.00416.84
8.0.100.0000.00716.97
8.0.90.0040.00416.78
8.0.80.0100.01016.91
8.0.70.0040.00416.91
8.0.60.0040.00416.75
8.0.50.0040.00416.79
8.0.30.0100.01017.27
8.0.20.0100.00817.40
8.0.10.0000.00716.93
8.0.00.0090.00916.59
7.4.330.0050.00015.55
7.4.320.0000.00616.57
7.4.300.0070.00016.62
7.4.290.0040.00816.37
7.4.280.0050.00316.56
7.4.270.0060.00316.47
7.4.260.0080.00316.50
7.4.250.0000.00716.34
7.4.240.0040.00416.46
7.4.230.0000.00816.42
7.4.220.0020.00516.33
7.4.210.0100.00316.59
7.4.200.0030.00316.50
7.4.160.0090.00716.48
7.4.140.0130.00617.86
7.4.130.0150.00616.35
7.4.120.0060.01216.55
7.4.110.0100.00716.60
7.4.100.0070.01416.50
7.4.90.0110.01116.45
7.4.80.0100.01019.39
7.4.70.0090.01516.54
7.4.60.0070.01016.57
7.4.50.0030.01016.38
7.4.40.0160.00616.40
7.4.10.0150.00414.94
7.4.00.0050.01214.88
7.3.330.0040.00413.43
7.3.320.0000.00613.14
7.3.310.0000.00716.39
7.3.300.0070.00016.38
7.3.290.0000.00716.25
7.3.280.0070.01016.35
7.3.260.0110.00816.58
7.3.240.0050.01116.50
7.3.230.0060.01016.69
7.3.210.0130.01016.41
7.3.200.0100.01016.66
7.3.190.0090.00616.42
7.3.180.0100.00716.45
7.3.170.0120.00616.58
7.3.160.0060.01016.42
7.3.130.0030.01414.78
7.3.120.0050.01214.80
7.3.110.0060.01114.98
7.3.100.0090.00714.80
7.3.90.0060.00814.87
7.3.80.0070.00914.62
7.3.70.0040.00914.83
7.3.60.0060.00814.87
7.3.50.0030.00614.67
7.3.40.0080.00614.92
7.3.30.0130.00214.87
7.3.20.0080.00516.61
7.3.10.0070.00716.49
7.3.00.0040.00816.62
7.2.330.0060.01216.79
7.2.320.0130.00316.70
7.2.310.0060.01316.67
7.2.300.0130.01016.63
7.2.290.0080.00816.72
7.2.260.0070.01015.32
7.2.250.0060.01115.00
7.2.240.0060.00915.15
7.2.230.0020.01115.23
7.2.220.0100.00615.18
7.2.210.0100.00415.28
7.2.200.0050.00515.17
7.2.190.0060.00514.99
7.2.180.0070.00515.01
7.2.170.0110.00314.93
7.2.160.0030.01015.20
7.2.150.0070.01016.98
7.2.140.0070.00417.11
7.2.130.0040.01116.79
7.2.120.0040.01016.79
7.2.110.0060.01016.80
7.2.100.0100.00516.93
7.2.90.0290.00816.23
7.2.80.0110.00916.01
7.2.70.0130.00516.16
7.2.60.0270.01316.22
7.2.50.0210.00916.35
7.2.40.0240.01016.25
7.2.30.0340.00616.33
7.2.20.0360.01016.19
7.2.10.0340.00516.19
7.2.00.0330.00316.23
7.1.330.0070.00915.87
7.1.320.0120.00215.79
7.1.310.0040.00915.84
7.1.300.0080.00615.87
7.1.290.0050.00815.74
7.1.280.0060.00815.78
7.1.270.0030.01015.82
7.1.260.0060.00815.70
7.1.250.0050.00815.76
7.1.240.0000.01515.72
7.1.230.0060.00615.46
7.1.220.0040.00815.82
7.1.210.0040.01114.73
7.1.200.0250.00714.78
7.1.190.0320.00314.88
7.1.180.0300.01014.86
7.1.170.0380.01114.62
7.1.160.0420.00814.70
7.1.150.0390.01114.84
7.1.140.0790.01014.71
7.1.130.0320.00814.92
7.1.120.0490.00514.88
7.1.110.0090.01014.84
7.1.100.0450.01114.83
7.1.90.0340.00714.65
7.1.80.0390.00314.72
7.1.70.0400.00814.87
7.1.60.0520.00923.91
7.1.50.0410.01123.78
7.1.40.0490.01223.86
7.1.30.0450.01223.77
7.1.20.0460.00623.85
7.1.10.0240.01114.80
7.1.00.0360.00614.81
7.0.330.0040.01115.48
7.0.320.0030.00915.30
7.0.310.0040.00415.34
7.0.300.0000.01115.39
7.0.290.0000.01215.04
7.0.280.0030.00815.48
7.0.270.0070.00315.29
7.0.260.0000.00815.15
7.0.250.0030.00915.28
7.0.240.0030.01015.45
7.0.230.0070.00715.41
7.0.220.0030.00915.20
7.0.210.0040.00715.18
7.0.200.0090.00615.34
7.0.190.0060.00315.31
7.0.180.0060.00915.18
7.0.170.0040.00715.43
7.0.160.0090.00615.23
7.0.150.0090.00615.22
7.0.140.0030.00715.34
7.0.130.0060.00315.30
7.0.120.0090.00915.48
7.0.110.0110.00715.00
7.0.100.0110.00415.31
7.0.90.0070.00715.13
7.0.80.0050.00315.32
7.0.70.0070.00715.34
7.0.60.0060.00915.38
7.0.50.0060.01215.40
7.0.40.0120.00313.08
7.0.30.0060.00313.25
7.0.20.0070.00713.38
7.0.10.0000.01313.32
7.0.00.0000.01313.43
5.6.400.0000.01513.83
5.6.390.0090.00614.23
5.6.380.0090.00314.40
5.6.370.0040.01114.36
5.6.360.0000.01514.23
5.6.350.0060.00914.08
5.6.340.0040.00713.87
5.6.330.0040.00414.01
5.6.320.0040.00813.95
5.6.310.0030.01314.01
5.6.300.0070.01014.46
5.6.290.0040.00814.10
5.6.280.0070.00314.07
5.6.270.0030.01014.20
5.6.260.0030.01014.13
5.6.250.0060.01214.18
5.6.240.0050.00814.13
5.6.230.0070.00714.30
5.6.220.0030.01214.10
5.6.210.0080.00814.03
5.6.200.0130.00314.25
5.6.190.0060.01214.30
5.6.180.0090.00414.30
5.6.170.0030.00914.02
5.6.160.0000.01514.22
5.6.150.0070.01014.25
5.6.140.0040.01114.23
5.6.130.0030.01314.13
5.6.120.0000.01714.05
5.6.110.0030.01013.85
5.6.100.0030.01314.34
5.6.90.0090.00614.01
5.6.80.0030.01013.77
5.6.70.0100.00314.02
5.6.60.0000.01413.84
5.6.50.0060.00913.98
5.6.40.0090.00314.14
5.6.30.0140.00014.28
5.6.20.0090.00014.11
5.6.10.0040.00814.09
5.6.00.0080.00013.96

preferences:
36.11 ms | 400 KiB | 5 Q