3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isAnagram( $phrase1, $phrase2 ) { $phrase1 = strtolower(preg_replace("/[^a-zA-Z]/", "", $phrase1)); $phrase2 = strtolower(preg_replace("/[^a-zA-Z]/", "", $phrase2)); // todo: fix splitting $a1 = str_split($phrase1); $a2 = str_split($phrase2); sort($a1); sort($a2); $phrase1 = join("",$a1); $phrase2 = join("",$a2); echo $phrase1 . "\n"; return ( $phrase1 === $phrase2 ); } echo "Test1 = " . (isAnagram( "", "" ) ? "Is anagram" : "Is not") . "\n"; echo "Test2 = " . (isAnagram( "Dormitory", "Dirty room" ) ? "Is anagram" : "Is not") . "\n"; echo "Test3 = " . (isAnagram( "A decimal point", "I'm a dot in place" ) ? "Is anagram" : "Is not") . "\n"; echo "Test4 = " . (isAnagram( "A decimal point no?", "I'm a dot in place" ) ? "Is anagram" : "Is not") . "\n"; echo "Test5 = " . (isAnagram( "A decimal point", "I'm a dot in place yes?" ) ? "Is anagram" : "Is not") . "\n"; echo "Test6 = " . (isAnagram( "a", "b" ) ? "Is anagram" : "Is not") . "\n";

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.63
8.3.50.0150.00522.88
8.3.40.0090.01218.98
8.3.30.0070.01119.14
8.3.20.0040.00420.18
8.3.10.0040.00423.66
8.3.00.0000.00819.38
8.2.180.0100.00616.63
8.2.170.0140.00022.96
8.2.160.0080.00620.57
8.2.150.0000.00824.18
8.2.140.0070.00024.66
8.2.130.0070.00726.16
8.2.120.0000.00820.95
8.2.110.0040.00719.38
8.2.100.0110.00018.03
8.2.90.0020.01019.06
8.2.80.0050.00517.97
8.2.70.0030.00617.75
8.2.60.0040.00417.80
8.2.50.0040.00418.07
8.2.40.0000.00818.22
8.2.30.0040.00418.11
8.2.20.0060.00317.71
8.2.10.0040.00418.00
8.2.00.0060.00317.84
8.1.280.0120.00625.92
8.1.270.0080.00023.85
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0050.00519.33
8.1.230.0040.00720.85
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0070.00317.22
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0070.00418.70
8.1.160.0000.00822.11
8.1.150.0000.00718.83
8.1.140.0060.00317.68
8.1.130.0070.00017.87
8.1.120.0000.00717.67
8.1.110.0050.00317.63
8.1.100.0000.00917.58
8.1.90.0000.00717.63
8.1.80.0000.00717.47
8.1.70.0040.00417.63
8.1.60.0050.00317.74
8.1.50.0080.00017.57
8.1.40.0030.00517.71
8.1.30.0090.00017.75
8.1.20.0030.00617.78
8.1.10.0030.00517.62
8.1.00.0040.00417.64
8.0.300.0040.00418.77
8.0.290.0040.00417.13
8.0.280.0070.00018.53
8.0.270.0040.00417.29
8.0.260.0030.00317.30
8.0.250.0040.00417.21
8.0.240.0000.00817.08
8.0.230.0030.00317.16
8.0.220.0030.00317.06
8.0.210.0000.00717.13
8.0.200.0040.00417.10
8.0.190.0040.00417.04
8.0.180.0040.00416.97
8.0.170.0050.00317.12
8.0.160.0030.00517.08
8.0.150.0040.00416.95
8.0.140.0050.00316.89
8.0.130.0000.00813.54
8.0.120.0050.00216.89
8.0.110.0050.00217.09
8.0.100.0040.00416.86
8.0.90.0070.00016.96
8.0.80.0040.01217.04
8.0.70.0000.00816.92
8.0.60.0050.00216.96
8.0.50.0000.00817.09
8.0.30.0100.01317.24
8.0.20.0090.01117.44
8.0.10.0070.00016.99
8.0.00.0050.01316.76
7.4.330.0000.00615.23
7.4.320.0000.00616.75
7.4.300.0000.00616.84
7.4.290.0040.00416.75
7.4.280.0000.00716.71
7.4.270.0030.00316.73
7.4.260.0000.00816.69
7.4.250.0040.00416.69
7.4.240.0050.00316.70
7.4.230.0040.00416.79
7.4.220.0180.00316.84
7.4.210.0100.00716.79
7.4.200.0080.00016.86
7.4.160.0130.00816.73
7.4.150.0070.01117.40
7.4.140.0100.00917.86
7.4.130.0120.00916.76
7.4.120.0090.00916.72
7.4.110.0090.00916.66
7.4.100.0160.00316.61
7.4.90.0120.00616.66
7.4.80.0120.00619.39
7.4.70.0110.00516.91
7.4.60.0070.01016.54
7.4.50.0040.00416.65
7.4.40.0100.01016.82
7.4.30.0080.01116.57
7.4.00.0070.01015.23
7.3.330.0000.00613.54
7.3.320.0030.00313.45
7.3.310.0000.00816.40
7.3.300.0030.00316.39
7.3.290.0070.01316.54
7.3.280.0100.00816.53
7.3.270.0090.01217.40
7.3.260.0140.00316.83
7.3.250.0130.00316.57
7.3.240.0090.00916.94
7.3.230.0140.00516.73
7.3.210.0140.00916.71
7.3.200.0000.01719.39
7.3.190.0030.01416.85
7.3.180.0060.00916.48
7.3.170.0070.01416.69
7.3.160.0060.01016.70
7.2.330.0100.00716.85
7.2.320.0100.01416.88
7.2.310.0170.00316.95
7.2.300.0140.00316.77
7.2.290.0030.02016.83
7.2.110.0300.00716.69
7.2.60.0070.01017.04
7.2.00.0000.01219.70
7.1.200.0070.00016.06
7.1.100.0000.00818.17
7.1.70.0040.00417.46
7.1.60.0070.01419.46
7.1.50.0070.00717.34
7.1.00.0070.07322.29
7.0.200.0000.00716.96
7.0.140.0070.07021.95
7.0.110.0100.08019.93
7.0.100.0100.04720.00
7.0.90.0070.08720.05
7.0.80.0130.07720.13
7.0.70.0200.06720.11
7.0.60.0030.07720.02
7.0.50.0170.04020.28
7.0.40.0100.07020.20
7.0.30.0070.07320.23
7.0.20.0030.04720.05
7.0.10.0100.04320.14
7.0.00.0100.08720.02
5.6.250.0000.08020.89
5.6.240.0070.08720.56
5.6.230.0200.06720.56
5.6.220.0100.06720.84
5.6.210.0030.05320.61
5.6.200.0100.08021.13
5.6.190.0030.08720.96
5.6.180.0100.07320.99
5.6.170.0100.08321.14
5.6.160.0030.04020.95
5.6.150.0000.08720.99
5.6.140.0170.06721.14
5.6.130.0000.07720.93
5.6.120.0030.04321.22
5.6.110.0000.04321.21
5.6.100.0070.04321.25
5.6.90.0030.04721.10
5.6.80.0000.04320.48
5.6.70.0070.03720.46
5.6.60.0100.03720.49
5.6.50.0070.06320.37
5.6.40.0070.04020.45
5.6.30.0070.03720.42
5.6.20.0070.05020.28
5.6.10.0100.03720.64
5.6.00.0100.03320.56
5.5.380.0100.04720.41
5.5.370.0030.08020.42
5.5.360.0030.08720.56
5.5.350.0100.07020.39
5.5.340.0030.08020.93
5.5.330.0000.04720.99
5.5.320.0100.04721.04
5.5.310.0070.06320.89
5.5.300.0030.07320.90
5.5.290.0030.08320.89
5.5.280.0030.05020.79
5.5.270.0030.07320.80
5.5.260.0070.03720.89
5.5.250.0000.04320.82
5.5.240.0030.04020.38
5.5.230.0030.04020.16
5.5.220.0000.07320.16
5.5.210.0030.04720.29
5.5.200.0030.05020.14
5.5.190.0000.04720.07
5.5.180.0030.04020.23
5.5.160.0030.03720.30
5.5.150.0030.04020.09
5.5.140.0030.03720.25
5.5.130.0030.04020.13
5.5.120.0070.03720.25
5.5.110.0030.05020.38
5.5.100.0030.05019.97
5.5.90.0100.03019.97
5.5.80.0070.05720.21
5.5.70.0030.03720.19
5.5.60.0030.03720.19
5.5.50.0100.04720.03
5.5.40.0130.02720.09
5.5.30.0030.04320.24
5.5.20.0000.04320.10
5.5.10.0030.03720.07
5.5.00.0070.03720.21
5.4.450.0070.07719.56
5.4.440.0000.04019.57
5.4.430.0030.03719.31
5.4.420.0030.04019.31
5.4.410.0000.04319.44
5.4.400.0100.03019.34
5.4.390.0070.03719.00
5.4.380.0070.07319.01
5.4.370.0070.05719.03
5.4.360.0070.05719.24
5.4.350.0000.04019.02
5.4.340.0000.05319.01
5.4.320.0030.03719.32
5.4.310.0070.03319.21
5.4.300.0030.03719.18
5.4.290.0030.05319.01
5.4.280.0070.03318.95
5.4.270.0000.04019.31
5.4.260.0030.04018.97
5.4.250.0030.03318.98
5.4.240.0100.03019.33
5.4.230.0000.04019.17
5.4.220.0030.03719.03
5.4.210.0030.03319.31
5.4.200.0000.04018.95
5.4.190.0000.04018.98
5.4.180.0070.05719.02
5.4.170.0030.05319.16
5.4.160.0000.04018.93
5.4.150.0100.03319.32
5.4.140.0030.03316.36
5.4.130.0000.03716.30
5.4.120.0030.04716.32
5.4.110.0030.06316.59
5.4.100.0030.07716.43
5.4.90.0000.08016.52
5.4.80.0000.07016.43
5.4.70.0170.06016.25
5.4.60.0130.07016.39
5.4.50.0100.06316.56
5.4.40.0000.04716.60
5.4.30.0000.08016.54
5.4.20.0100.07016.39
5.4.10.0100.06316.54
5.4.00.0170.05315.80
5.3.290.0030.05714.91
5.3.280.0000.04014.63
5.3.270.0070.03314.74
5.3.260.0070.03314.75
5.3.250.0030.04314.74
5.3.240.0000.03714.62
5.3.230.0100.03014.64
5.3.220.0070.03314.65
5.3.210.0030.03314.57
5.3.200.0000.07714.62
5.3.190.0070.07714.70
5.3.180.0230.05314.59
5.3.170.0100.07014.44
5.3.160.0100.07014.59
5.3.150.0100.04014.71
5.3.140.0030.07014.69
5.3.130.0200.06014.57
5.3.120.0030.07314.64
5.3.110.0000.07714.55
5.3.100.0100.06714.17
5.3.90.0070.05314.02
5.3.80.0100.07014.11
5.3.70.0070.07014.11
5.3.60.0030.06713.97
5.3.50.0130.06313.93
5.3.40.0030.07713.94
5.3.30.0100.07014.14
5.3.20.0030.07313.55
5.3.10.0070.07313.67
5.3.00.0170.06313.65
5.2.170.0030.06011.11
5.2.160.0070.03311.29
5.2.150.0100.05711.14
5.2.140.0030.06311.29
5.2.130.0030.06711.25
5.2.120.0030.06011.11
5.2.110.0030.06311.18
5.2.100.0070.06311.24
5.2.90.0100.06011.34
5.2.80.0000.07011.11
5.2.70.0000.06311.19
5.2.60.0000.06311.12
5.2.50.0070.06011.11
5.2.40.0000.05011.02
5.2.30.0070.04310.96
5.2.20.0030.06710.82
5.2.10.0030.06011.00
5.2.00.0070.05710.85
5.1.60.0100.04710.07
5.1.50.0070.04710.16
5.1.40.0070.04710.05
5.1.30.0000.05710.36
5.1.20.0070.05010.35
5.1.10.0030.05310.05
5.1.00.0100.05010.33
5.0.50.0070.0438.52
5.0.40.0030.0308.41
5.0.30.0000.0678.20
5.0.20.0000.0508.12
5.0.10.0030.0478.18
5.0.00.0030.0608.25
4.4.90.0070.0138.01
4.4.80.0000.0278.01
4.4.70.0030.0338.01
4.4.60.0000.0338.01
4.4.50.0000.0308.01
4.4.40.0030.0478.01
4.4.30.0030.0378.01
4.4.20.0030.0338.01
4.4.10.0000.0378.01
4.4.00.0070.0478.01
4.3.110.0030.0278.01
4.3.100.0030.0338.01
4.3.90.0000.0338.01
4.3.80.0030.0508.01
4.3.70.0000.0378.01
4.3.60.0000.0208.01
4.3.50.0000.0408.01
4.3.40.0030.0408.01
4.3.30.0030.0338.01
4.3.20.0030.0378.01
4.3.10.0000.0308.01
4.3.00.0030.0338.01

preferences:
30.87 ms | 401 KiB | 5 Q