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); 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";

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.0060.00916.73
8.3.50.0110.01022.92
8.3.40.0070.00718.79
8.3.30.0070.00719.08
8.3.20.0000.00820.39
8.3.10.0080.00023.48
8.3.00.0050.00319.50
8.2.180.0040.01216.50
8.2.170.0110.00422.96
8.2.160.0110.00420.48
8.2.150.0000.00724.18
8.2.140.0060.00324.66
8.2.130.0070.00726.16
8.2.120.0080.00021.10
8.2.110.0030.00620.52
8.2.100.0080.00418.09
8.2.90.0030.00619.17
8.2.80.0030.00517.97
8.2.70.0030.00717.75
8.2.60.0040.00417.80
8.2.50.0050.00318.07
8.2.40.0030.00518.28
8.2.30.0040.00418.18
8.2.20.0030.00517.86
8.2.10.0000.00818.06
8.2.00.0000.00817.77
8.1.280.0100.00725.92
8.1.270.0000.00923.84
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0070.00323.81
8.1.230.0070.00419.28
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0030.00617.25
8.1.190.0000.00817.50
8.1.180.0000.00818.10
8.1.170.0040.00418.91
8.1.160.0040.00422.09
8.1.150.0070.00018.89
8.1.140.0000.00817.70
8.1.130.0040.00417.77
8.1.120.0040.00417.72
8.1.110.0040.00417.68
8.1.100.0090.00017.54
8.1.90.0040.00317.62
8.1.80.0040.00417.60
8.1.70.0000.00717.61
8.1.60.0030.00517.81
8.1.50.0080.00017.73
8.1.40.0050.00217.71
8.1.30.0030.00617.89
8.1.20.0040.00417.86
8.1.10.0000.00717.72
8.1.00.0000.00817.67
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0000.00718.44
8.0.270.0000.00717.27
8.0.260.0030.00317.34
8.0.250.0030.00317.23
8.0.240.0060.00317.20
8.0.230.0050.00317.18
8.0.220.0000.00717.20
8.0.210.0040.00417.02
8.0.200.0040.00417.18
8.0.190.0060.00317.11
8.0.180.0030.00517.06
8.0.170.0040.00417.00
8.0.160.0040.00417.07
8.0.150.0070.00016.88
8.0.140.0050.00216.96
8.0.130.0060.00013.55
8.0.120.0080.00016.94
8.0.110.0070.00017.00
8.0.100.0000.00816.88
8.0.90.0000.00917.14
8.0.80.0070.01017.05
8.0.70.0040.00416.97
8.0.60.0040.00417.04
8.0.50.0040.00416.96
8.0.30.0080.01117.20
8.0.20.0140.00817.46
8.0.10.0040.00417.04
8.0.00.0050.01417.00
7.4.330.0030.00315.02
7.4.320.0000.00616.86
7.4.300.0030.00316.65
7.4.290.0000.00716.66
7.4.280.0070.00016.84
7.4.270.0000.00716.77
7.4.260.0000.00716.86
7.4.250.0040.00416.67
7.4.240.0010.00616.76
7.4.230.0000.00716.64
7.4.220.0090.00916.80
7.4.210.0000.01416.86
7.4.200.0000.00816.60
7.4.160.0060.01616.69
7.4.150.0100.00917.40
7.4.140.0100.00917.86
7.4.130.0110.01016.89
7.4.120.0080.00816.69
7.4.110.0000.01716.81
7.4.100.0120.01016.75
7.4.90.0140.00516.67
7.4.80.0090.01319.39
7.4.70.0060.00916.62
7.4.60.0040.01416.72
7.4.50.0000.00816.51
7.4.40.0120.00616.90
7.4.30.0060.01216.66
7.4.00.0050.01315.12
7.3.330.0050.00013.44
7.3.320.0050.00013.45
7.3.310.0030.00316.33
7.3.300.0030.00316.38
7.3.290.0150.00616.49
7.3.280.0060.01116.48
7.3.270.0110.00817.40
7.3.260.0110.00616.62
7.3.250.0060.01016.46
7.3.240.0130.00316.83
7.3.230.0060.01616.81
7.3.210.0120.00616.73
7.3.200.0120.00619.39
7.3.190.0090.00916.86
7.3.180.0060.01016.43
7.3.170.0090.01216.72
7.3.160.0080.00816.75
7.3.120.0040.01514.93
7.3.110.0100.01015.06
7.3.100.0090.00615.04
7.3.90.0060.00614.84
7.3.80.0100.00014.93
7.3.70.0030.00914.98
7.3.60.0110.00415.12
7.3.50.0030.00915.11
7.3.40.0060.00614.70
7.3.30.0090.00614.66
7.3.20.0070.01316.91
7.3.10.0060.01316.80
7.3.00.0100.00416.78
7.2.330.0140.00716.93
7.2.320.0030.01416.89
7.2.310.0170.00016.89
7.2.300.0100.00716.95
7.2.290.0090.01216.79
7.2.250.0090.01215.30
7.2.240.0030.01715.13
7.2.230.0030.01015.11
7.2.220.0000.01115.44
7.2.210.0080.00015.38
7.2.200.0060.00915.35
7.2.190.0070.00414.94
7.2.180.0070.00314.83
7.2.170.0080.00815.33
7.2.130.0040.01316.89
7.2.120.0040.01317.02
7.2.110.0080.00816.99
7.2.100.0090.00616.88
7.2.90.0090.00617.04
7.2.80.0070.01016.98
7.2.70.0070.00717.07
7.2.60.0080.01116.71
7.2.50.0090.00916.92
7.2.40.0070.00416.98
7.2.30.0090.00616.99
7.2.20.0070.00316.59
7.2.10.0060.01116.89
7.2.00.0040.01018.32
7.1.330.0090.00615.57
7.1.320.0070.00415.83
7.1.310.0070.00716.13
7.1.300.0000.01015.73
7.1.290.0040.00815.98
7.1.280.0060.00915.96
7.1.270.0070.00716.05
7.1.260.0080.00415.91
7.1.250.0110.00715.86
7.1.100.0040.00818.41
7.1.70.0030.00717.10
7.1.60.0100.01619.46
7.1.50.0090.01217.21
7.1.00.0000.08022.46
7.0.200.0080.00016.91
7.0.140.0000.07322.07
7.0.60.0170.07319.94
7.0.50.0000.08717.91
7.0.40.0000.09020.32
7.0.30.0400.07020.35
7.0.20.0200.03720.18
7.0.10.0070.08320.07
7.0.00.0070.04320.20
5.6.280.0100.06721.07
5.6.210.0100.08320.65
5.6.200.0070.08718.29
5.6.190.0100.08320.61
5.6.180.0530.04020.48
5.6.170.0400.04020.62
5.6.160.0130.08320.52
5.6.150.0070.03718.18
5.6.140.0130.07018.24
5.6.130.0170.07318.17
5.6.120.0130.07721.14
5.6.110.0100.08021.14
5.6.100.0100.08021.01
5.6.90.0100.06321.13
5.6.80.0070.08320.38
5.5.350.0030.08020.41
5.5.340.0100.04318.05
5.5.330.0130.03320.13
5.5.320.0000.04720.20
5.5.310.0270.06320.30
5.5.300.0100.07717.96
5.5.290.0130.05017.97
5.5.280.0070.07320.83
5.5.270.0100.08320.87
5.5.260.0030.04720.89
5.5.250.0100.07320.47
5.5.240.0200.07320.13
5.4.450.0530.05019.32
5.4.440.0400.05719.41
5.4.430.0300.04719.41
5.4.420.0430.03019.30
5.4.410.0370.03719.44
5.4.400.0430.05318.98
5.4.390.0600.06019.31
5.4.380.0530.06719.09
5.4.370.0530.06719.09
5.4.360.0470.03719.07
5.4.350.0600.03719.22
5.4.340.0400.04718.91
5.4.320.0530.06019.16
5.4.310.0470.04018.87
5.4.300.0570.03319.22
5.4.290.0500.07018.87
5.4.280.0430.03719.22
5.4.270.0330.04718.99
5.4.260.0530.04719.06
5.4.250.0530.05019.23
5.4.240.0430.04318.98
5.4.230.0600.05719.20
5.4.220.0430.04019.08
5.4.210.0370.04318.94
5.4.200.0530.06319.08
5.4.190.0600.06019.14
5.4.180.0500.04719.21
5.4.170.0570.06318.93
5.4.160.0530.07019.29
5.4.150.0570.04319.22
5.4.140.0530.04016.55
5.4.130.0500.06316.38
5.4.120.0700.03016.72
5.4.110.0330.03716.51
5.4.100.0430.04716.63
5.4.90.0430.05716.50
5.4.80.0470.03316.39
5.4.70.0630.05316.55
5.4.60.0500.03316.51
5.4.50.0470.05716.52
5.4.40.0570.03716.53
5.4.30.0570.06016.37
5.4.20.0500.03316.48
5.4.10.0500.06716.34
5.4.00.0430.04716.07
5.3.290.0500.04014.79
5.3.280.0530.04014.82
5.3.270.0600.04714.60
5.3.260.0500.04714.63
5.3.250.0500.05014.62
5.3.240.0670.03714.61
5.3.230.0430.04314.59
5.3.220.0470.03714.68
5.3.210.0330.04014.79
5.3.200.0470.03314.49
5.3.190.0530.05714.47
5.3.180.0530.04314.66
5.3.170.0470.05714.61
5.3.160.0430.04014.61
5.3.150.0530.04314.79
5.3.140.0500.05714.55
5.3.130.0570.06014.47
5.3.120.0700.04714.48
5.3.110.0400.05014.67
5.3.100.0700.06314.05
5.3.90.0500.03014.07
5.3.80.0470.05314.13
5.3.70.0470.03314.07
5.3.60.0500.04014.16
5.3.50.0470.04314.00
5.3.40.0530.03014.03
5.3.30.0470.06313.82
5.3.20.0470.06013.70
5.3.10.0470.04313.67
5.3.00.0430.04313.75
5.2.170.0400.02711.31
5.2.160.0470.04011.08
5.2.150.0400.02711.15
5.2.140.0470.03311.13
5.2.130.0570.02711.11
5.2.120.0470.04711.02
5.2.110.0400.05711.03
5.2.100.0330.03711.22
5.2.90.0470.03311.20
5.2.80.0430.04311.20
5.2.70.0400.06011.00
5.2.60.0370.04011.05
5.2.50.0400.02711.10
5.2.40.0400.05010.97
5.2.30.0370.02710.91
5.2.20.0370.03310.95
5.2.10.0300.05710.87
5.2.00.0300.05310.81
5.1.60.0270.0339.90
5.1.50.0400.0309.91
5.1.40.0300.0239.87
5.1.30.0300.02710.31
5.1.20.0330.04310.44
5.1.10.0300.02710.20
5.1.00.0270.03010.16
5.0.50.0200.0208.56
5.0.40.0100.0378.43
5.0.30.0170.0308.32
5.0.20.0230.0308.21
5.0.10.0130.0238.41
5.0.00.0200.0278.40
4.4.90.0200.0306.47
4.4.80.0130.0176.47
4.4.70.0200.0236.47
4.4.60.0170.0206.47
4.4.50.0170.0206.47
4.4.40.0130.0376.47
4.4.30.0130.0176.47
4.4.20.0130.0176.47
4.4.10.0170.0306.47
4.4.00.0170.0476.47
4.3.110.0170.0136.47
4.3.100.0170.0136.47
4.3.90.0170.0176.47
4.3.80.0230.0406.47
4.3.70.0200.0306.47
4.3.60.0170.0276.47
4.3.50.0270.0176.47
4.3.40.0130.0336.47
4.3.30.0070.0236.47
4.3.20.0130.0136.47
4.3.10.0130.0136.47
4.3.00.0100.0336.47

preferences:
46.56 ms | 401 KiB | 5 Q