3v4l.org

run code in 500+ PHP versions simultaneously
<?php //If you add to the end the varname as Mobin F.R.G suggest in the comments $text1 = array ('fr', 'hr', 'test1'); $text2 = array ('el', 'hr', 'test2'); $text3 = array ('bg', 'en', 'es', 'test3'); $text4 = array ('bg', 'el', 'en', 'es', 'test4'); $text5 = array ('bg', 'el', 'en', 'es', 'fr', 'hr', 'test5'); //I assume you didn't mean to make and array of array. $order1 = array('bg', 'el'); $finalstr = ''; $aux = 0; //Checks first element $containPrev1 = in_array($order1[0], $text1); $containPrev2 = in_array($order1[0], $text2); $containPrev3 = in_array($order1[0], $text3); $containPrev4 = in_array($order1[0], $text4); $containPrev5 = in_array($order1[0], $text5); while($aux< count($order1)){ if (in_array($order1[$aux], $text1) && $containPrev1 == true) { $lastpos = (count($text1)-1); if(strpos($finalstr, $text1[$lastpos]) == false){ $finalstr = $finalstr . $text1[$lastpos].' '; } } else{$containPrev1 = false;} if (in_array($order1[$aux], $text2) && $containPrev2 == true) { $lastpos = (count($text2)-1); if(strpos($finalstr, $text2[$lastpos]) == false){ $finalstr = $finalstr . $text2[$lastpos] . ' '; } } else{$containPrev2 = false;} if (in_array($order1[$aux], $text3) && $containPrev3 == true) { $lastpos = (count($text3)-1); if(strpos($finalstr, $text3[$lastpos]) == false){ $finalstr = $finalstr . $text3[$lastpos] . ' '; } } else{$containPrev3 = false;} if (in_array($order1[$aux], $text4) && $containPrev4 == true) { $lastpos = (count($text4)-1); if(strpos($finalstr, $text4[$lastpos]) == false){ $finalstr = $finalstr . $text4[$lastpos] . ' '; } } else{$containPrev4 = false;} if (in_array($order1[$aux], $text5) && $containPrev5 == true) { $lastpos = (count($text5)-1); if(strpos($finalstr, $text5[$lastpos]) == false){ $finalstr = $finalstr . $text5[$lastpos] . ' '; } } else{$containPrev5 = false;} $aux++; } //Just to print the string $finalstr = trim($finalstr); $arrayfinal = explode(" ", $finalstr); print_r($arrayfinal);

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.5.30.0110.00621.34
8.5.20.0110.01019.52
8.5.10.0090.00816.82
8.5.00.0100.01120.05
8.4.180.0160.01122.09
8.4.170.0120.00923.88
8.4.160.0100.01223.96
8.4.150.0080.00516.87
8.4.140.0100.01217.54
8.4.130.0140.00617.88
8.4.120.0090.00520.26
8.4.110.0100.01022.48
8.4.100.0100.01017.81
8.4.90.0100.01118.86
8.4.80.0060.00517.72
8.4.70.0060.00317.94
8.4.60.0100.00417.98
8.4.50.0120.00818.99
8.4.40.0060.00719.37
8.4.30.0100.01017.77
8.4.20.0130.00719.46
8.4.10.0100.01017.77
8.3.300.0090.01119.20
8.3.290.0130.00920.92
8.3.280.0120.00918.46
8.3.270.0120.00816.71
8.3.260.0140.00516.49
8.3.250.0100.00619.00
8.3.240.0110.00816.74
8.3.230.0110.00816.68
8.3.220.0090.00917.12
8.3.210.0080.00718.36
8.3.200.0030.00616.75
8.3.190.0100.00817.02
8.3.180.0130.00616.52
8.3.170.0120.00616.49
8.3.160.0100.00718.95
8.3.150.0120.00317.31
8.3.140.0070.00716.72
8.3.130.0060.00318.60
8.3.120.0100.01018.96
8.3.110.0000.00820.94
8.3.100.0070.00424.06
8.3.90.0030.00526.77
8.3.80.0030.00617.97
8.3.70.0120.00318.31
8.3.60.0130.00716.63
8.3.50.0110.00417.47
8.3.40.0050.01018.84
8.3.30.0080.00618.67
8.3.20.0000.00819.01
8.3.10.0000.01021.76
8.3.00.0040.00423.48
8.2.300.0120.01020.50
8.2.290.0070.00320.66
8.2.280.0070.00418.35
8.2.270.0070.01116.44
8.2.260.0000.00820.42
8.2.250.0080.00016.76
8.2.240.0030.00618.93
8.2.230.0050.00322.58
8.2.220.0090.00037.54
8.2.210.0150.00326.77
8.2.200.0030.00618.41
8.2.190.0170.00716.63
8.2.180.0180.00318.32
8.2.170.0090.00622.96
8.2.160.0040.01118.98
8.2.150.0080.00024.18
8.2.140.0070.00024.66
8.2.130.0000.00720.39
8.2.120.0040.00426.35
8.2.110.0030.00722.27
8.2.100.0120.00017.66
8.2.90.0030.00618.03
8.2.80.0090.00017.97
8.2.70.0090.00017.75
8.2.60.0050.00317.75
8.2.50.0050.00317.59
8.2.40.0000.00817.91
8.2.30.0050.00319.22
8.2.20.0060.00318.02
8.2.10.0000.00719.42
8.2.00.0040.00419.39
8.1.340.0100.01017.47
8.1.330.0070.01122.14
8.1.320.0130.00516.21
8.1.310.0030.00516.64
8.1.300.0060.00317.98
8.1.290.0090.00030.84
8.1.280.0090.00625.92
8.1.270.0040.00420.24
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00323.61
8.1.230.0040.00723.98
8.1.220.0060.00317.88
8.1.210.0060.00619.03
8.1.200.0050.00517.35
8.1.190.0060.00617.35
8.1.180.0060.00318.10
8.1.170.0040.00417.62
8.1.160.0000.01018.87
8.1.150.0000.00718.87
8.1.140.0080.00017.63
8.1.130.0030.00318.91
8.1.120.0030.00517.38
8.1.110.0000.00717.46
8.1.100.0040.00417.52
8.1.90.0000.00917.53
8.1.80.0000.00817.39
8.1.70.0030.00317.38
8.1.60.0000.00817.64
8.1.50.0050.00317.52
8.1.40.0090.00017.55
8.1.30.0000.00917.72
8.1.20.0080.00017.66
8.1.10.0050.00317.61
8.1.00.0000.00717.56
8.0.300.0050.00320.03
8.0.290.0090.00016.75
8.0.280.0040.00418.46
8.0.270.0030.00317.19
8.0.260.0030.00317.32
8.0.250.0000.00717.02
8.0.240.0000.01116.89
8.0.230.0060.00317.01
8.0.220.0000.00716.95
8.0.210.0000.00716.93
8.0.200.0000.00617.02
8.0.190.0000.00916.98
8.0.180.0000.00816.94
8.0.170.0030.00616.95
8.0.160.0000.00717.00
8.0.150.0040.00416.85
8.0.140.0000.00816.91
8.0.130.0030.00313.43
8.0.120.0000.00816.92
8.0.110.0000.00716.88
8.0.100.0000.00716.98
8.0.90.0070.00016.70
8.0.80.0120.00916.91
8.0.70.0040.00416.79
8.0.60.0040.00416.83
8.0.50.0030.00316.79
8.0.30.0130.00817.07
8.0.20.0130.01017.40
8.0.10.0040.00416.92
8.0.00.0150.00616.82
7.4.330.0000.00415.55
7.4.320.0030.00516.54
7.4.300.0060.00016.62
7.4.290.0000.00616.53
7.4.280.0030.00516.53
7.4.270.0050.00316.61
7.4.260.0030.00316.61
7.4.250.0070.00016.57
7.4.240.0070.00016.63
7.4.230.0040.00416.65
7.4.220.0060.00316.53
7.4.210.0060.00916.68
7.4.200.0030.00316.54
7.4.160.0090.00916.56
7.4.140.0130.00717.86
7.4.130.0090.01216.49
7.4.120.0090.00916.55
7.4.110.0090.00916.30
7.4.100.0120.00916.49
7.4.90.0060.01216.63
7.4.80.0120.00919.39
7.4.70.0030.01316.53
7.4.60.0120.00916.57
7.4.50.0000.01316.69
7.4.40.0130.01216.46
7.4.10.0100.00814.92
7.4.00.0110.00614.91
7.3.330.0000.00613.09
7.3.320.0000.00513.26
7.3.310.0070.00016.38
7.3.300.0000.00616.25
7.3.290.0030.00316.21
7.3.280.0070.01116.43
7.3.260.0130.00816.44
7.3.240.0120.00816.43
7.3.230.0090.01216.34
7.3.210.0150.00416.41
7.3.200.0080.00916.44
7.3.190.0120.00616.37
7.3.180.0060.01016.27
7.3.170.0060.01216.58
7.3.160.0060.01016.42
7.3.130.0110.00415.04
7.3.120.0060.01014.91
7.3.110.0100.00814.85
7.3.100.0030.01314.91
7.3.90.0110.00514.63
7.3.80.0040.00715.05
7.3.70.0060.00914.92
7.3.60.0100.00514.90
7.3.50.0070.00814.92
7.3.40.0060.00814.94
7.3.30.0080.00614.75
7.3.20.0060.00816.73
7.3.10.0040.00516.59
7.3.00.0110.00516.69
7.2.330.0150.00316.37
7.2.320.0070.01016.87
7.2.310.0150.00916.79
7.2.300.0090.00916.73
7.2.290.0080.01616.63
7.2.260.0090.01115.05
7.2.250.0100.00815.04
7.2.240.0050.00915.13
7.2.230.0100.00915.18
7.2.220.0070.01115.14
7.2.210.0070.00515.04
7.2.200.0110.00315.15
7.2.190.0060.01015.10
7.2.180.0050.00714.88
7.2.170.0050.00915.04
7.2.160.0050.00915.10
7.2.150.0050.00916.89
7.2.140.0030.00816.88
7.2.130.0050.00616.96
7.2.120.0070.00516.89
7.2.110.0070.00617.09
7.2.100.0070.00516.93
7.2.90.0030.01217.02
7.2.80.0060.00817.00
7.2.70.0090.00516.78
7.2.60.0080.00816.63
7.2.50.0090.00516.87
7.2.40.0090.00516.77
7.2.30.0060.01016.92
7.2.20.0060.00816.79
7.2.10.0050.01016.81
7.2.00.0070.00716.85
7.1.330.0060.00715.74
7.1.320.0080.01015.86
7.1.310.0110.00215.86
7.1.300.0090.00315.69
7.1.290.0050.00615.81
7.1.280.0050.00915.79
7.1.270.0050.00815.96
7.1.260.0060.00715.93
7.1.250.0070.00915.78
7.1.240.0050.01015.80
7.1.230.0060.00615.91
7.1.220.0050.00915.73
7.1.210.0050.01015.63
7.1.200.0060.00815.82
7.1.190.0080.00515.75
7.1.180.0060.00715.78
7.1.170.0040.00615.53
7.1.160.0030.01015.89
7.1.150.0060.00915.77
7.1.140.0060.00615.61
7.1.130.0050.01015.81
7.1.120.0060.00815.75
7.1.110.0090.00415.80
7.1.100.0070.00915.69
7.1.90.0030.01015.66
7.1.80.0070.00715.60
7.1.70.0070.00815.56
7.1.60.0180.00621.67
7.1.50.0150.00621.77
7.1.40.0120.00821.59
7.1.30.0100.01121.65
7.1.20.0100.00921.65
7.1.10.0080.00715.52
7.1.00.0050.00915.78
7.0.330.0070.00815.46
7.0.320.0070.00615.40
7.0.310.0050.00515.28
7.0.300.0050.00515.18
7.0.290.0040.01115.32
7.0.280.0060.00715.43
7.0.270.0070.00715.44
7.0.260.0060.00815.42
7.0.250.0070.00515.60
7.0.240.0070.00515.57
7.0.230.0080.00315.40
7.0.220.0050.00815.43
7.0.210.0030.01015.56
7.0.200.0020.01115.55
7.0.190.0060.00915.48
7.0.180.0000.01415.37
7.0.170.0050.00615.54
7.0.160.0070.00815.46
7.0.150.0050.00715.46
7.0.140.0050.00715.62
7.0.130.0060.00615.52
7.0.120.0060.00715.56
7.0.110.0050.00715.47
7.0.100.0060.00415.52
7.0.90.0060.00315.53
7.0.80.0090.00615.37
7.0.70.0050.00515.55
7.0.60.0020.01215.54
7.0.50.0070.00415.57
7.0.40.0050.01013.50
7.0.30.0000.01313.35
7.0.20.0030.00813.57
7.0.10.0020.01013.48
7.0.00.0070.00513.39
5.6.400.0020.00814.48
5.6.390.0050.00914.47
5.6.380.0070.01014.67
5.6.370.0000.01314.32
5.6.360.0080.00314.13
5.6.350.0040.00814.47
5.6.340.0070.00514.58
5.6.330.0050.00814.48
5.6.320.0030.01014.61
5.6.310.0030.00814.51
5.6.300.0070.01114.61
5.6.290.0020.01414.42
5.6.280.0020.01314.30
5.6.270.0030.01114.23
5.6.260.0070.00814.43
5.6.250.0040.00814.46
5.6.240.0070.00614.48
5.6.230.0050.01114.39
5.6.220.0040.01114.29
5.6.210.0050.01014.42
5.6.200.0050.01014.33
5.6.190.0080.00514.46
5.6.180.0030.01214.34
5.6.170.0080.00514.44
5.6.160.0020.01214.37
5.6.150.0030.01014.23
5.6.140.0080.00614.39
5.6.130.0090.00614.49
5.6.120.0060.00914.41
5.6.110.0040.01114.67
5.6.100.0090.00314.24
5.6.90.0030.00814.36
5.6.80.0090.00314.34
5.6.70.0050.00814.22
5.6.60.0090.00514.34
5.6.50.0000.01114.27
5.6.40.0070.00714.31
5.6.30.0050.00914.55
5.6.20.0000.01214.17
5.6.10.0070.00714.38
5.6.00.0070.00314.10

preferences:
48.5 ms | 1939 KiB | 5 Q