3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tag($str,$pos1,$pos2) { $offset=-1; $arrs=explode("-",$str); list($pos1,$pos2)=array(min($pos1,$pos2),max($pos1,$pos2)); foreach($arrs as &$chunk) { $len=strlen($chunk); if($offset+1>$pos2) break; if($offset+1<=$pos2 && $offset+$len>=$pos2) { $chunk=substr($chunk,0,$pos2-$offset-1)."<span style='color:red'>".substr($chunk,$pos2-$offset-1,1)."</span>".substr($chunk,$pos2-$offset); } if($offset+1<=$pos1 && $offset+$len>=$pos1) { $chunk=substr($chunk,0,$pos1-$offset-1)."<span style='color:red'>".substr($chunk,$pos1-$offset-1,1)."</span>".substr($chunk,$pos1-$offset); } $offset+=$len; } return $arrs; } print_r(tag("55798-45366-11255-48084-35644-28027-85391-45536-85002-55350-4166-5991-0313-3681-9382-9143-2852-8142-8643-0235-875-383-839-92-91-00-81",5,8));

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.40.0060.00918.82
8.3.30.0110.00318.85
8.3.20.0050.00318.90
8.3.10.0000.00818.69
8.3.00.0060.00319.38
8.2.170.0120.00618.96
8.2.160.0110.00722.96
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00021.12
8.2.110.0030.00720.25
8.2.100.0070.00718.03
8.2.90.0040.00417.84
8.2.80.0040.00419.18
8.2.70.0050.00317.77
8.2.60.0050.00318.04
8.2.50.0060.00318.10
8.2.40.0050.00520.61
8.2.30.0030.00518.18
8.2.20.0030.00617.55
8.2.10.0040.00417.88
8.2.00.0030.00617.77
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00322.43
8.1.230.0090.00320.95
8.1.220.0080.00017.79
8.1.210.0040.00418.92
8.1.200.0060.00317.47
8.1.190.0060.00317.35
8.1.180.0030.00618.10
8.1.170.0000.00918.70
8.1.160.0000.00818.76
8.1.150.0000.00718.71
8.1.140.0070.00017.52
8.1.130.0050.00219.18
8.1.120.0000.00717.49
8.1.110.0060.00317.48
8.1.100.0040.00417.42
8.1.90.0020.00517.48
8.1.80.0040.00417.41
8.1.70.0000.00717.36
8.1.60.0040.00417.61
8.1.50.0030.00717.57
8.1.40.0030.00517.56
8.1.30.0060.00317.56
8.1.20.0070.00317.63
8.1.10.0090.00017.66
8.1.00.0040.00417.57
8.0.300.0040.00420.18
8.0.290.0000.00916.63
8.0.280.0000.00718.39
8.0.270.0000.00916.90
8.0.260.0000.00618.35
8.0.250.0000.00816.92
8.0.240.0000.00716.85
8.0.230.0040.00416.93
8.0.220.0050.00316.94
8.0.210.0040.00416.92
8.0.200.0000.00817.02
8.0.190.0050.00216.89
8.0.180.0000.00816.95
8.0.170.0000.00816.95
8.0.160.0000.00716.89
8.0.150.0040.00416.90
8.0.140.0080.00316.84
8.0.130.0050.00013.37
8.0.120.0000.00916.94
8.0.110.0000.00716.79
8.0.100.0050.00316.91
8.0.90.0000.00816.98
8.0.80.0000.01416.86
8.0.70.0060.00316.73
8.0.60.0090.00016.96
8.0.50.0000.00816.86
8.0.30.0120.00617.21
8.0.20.0090.01016.96
8.0.10.0050.00217.02
8.0.00.0120.00716.80
7.4.330.0000.00512.93
7.4.320.0060.00016.52
7.4.300.0030.00316.45
7.4.290.0030.00416.63
7.4.280.0040.00816.57
7.4.270.0040.00416.42
7.4.260.0030.00313.30
7.4.250.0000.00816.66
7.4.240.0030.00316.52
7.4.230.0030.00316.37
7.4.220.0030.00316.66
7.4.210.0090.01316.66
7.4.200.0030.00416.61
7.4.190.0040.00416.76
7.4.160.0110.00716.65
7.4.150.0080.01116.46
7.4.140.0040.01317.86
7.4.130.0060.02116.50
7.4.120.0100.01316.59
7.4.110.0110.01016.57
7.4.100.0090.00916.55
7.4.90.0130.00716.52
7.4.80.0110.00719.39
7.4.70.0160.00616.57
7.4.60.0130.00316.69
7.4.50.0020.00216.55
7.4.40.0070.00716.39
7.4.30.0100.01216.68
7.4.10.0070.01315.24
7.4.00.0040.01314.74
7.3.330.0000.00613.45
7.3.320.0060.00013.29
7.3.310.0000.00716.27
7.3.300.0000.00616.41
7.3.290.0070.00716.36
7.3.280.0090.00616.37
7.3.270.0060.01116.55
7.3.260.0070.01516.44
7.3.240.0080.00816.36
7.3.230.0090.00616.45
7.3.210.0130.00316.50
7.3.200.0100.01316.41
7.3.190.0030.01216.36
7.3.180.0090.01216.66
7.3.170.0030.01316.54
7.3.160.0130.00316.57
7.3.130.0100.00315.12
7.3.120.0100.00414.96
7.3.110.0100.01014.96
7.3.100.0030.01015.08
7.3.90.0000.01714.94
7.3.80.0000.01214.60
7.3.70.0030.01014.72
7.3.60.0040.00814.75
7.3.50.0040.00714.75
7.3.40.0040.00814.83
7.3.30.0000.01614.95
7.3.20.0060.00316.76
7.3.10.0030.00916.76
7.3.00.0120.00016.73
7.2.330.0120.00616.79
7.2.320.0120.00816.73
7.2.310.0080.00816.68
7.2.300.0070.01316.69
7.2.290.0120.00416.89
7.2.260.0060.00615.05
7.2.250.0090.00915.03
7.2.240.0070.00714.73
7.2.230.0100.00715.29
7.2.220.0030.00915.38
7.2.210.0130.00014.98
7.2.200.0090.00615.13
7.2.190.0030.00915.14
7.2.180.0030.01215.04
7.2.170.0100.00315.05
7.2.160.0040.01114.96
7.2.150.0060.00616.88
7.2.140.0000.01317.12
7.2.130.0080.00817.03
7.2.120.0140.00016.84
7.2.110.0000.01517.10
7.2.100.0070.00716.73
7.2.90.0000.01517.04
7.2.80.0070.00316.62
7.2.70.0090.00316.91
7.2.60.0060.00816.65
7.2.50.0110.00317.15
7.2.40.0040.00716.67
7.2.30.0060.00616.88
7.2.20.0060.00616.95
7.2.10.0000.01016.95
7.2.00.0070.00518.19
7.1.330.0040.01116.04
7.1.320.0060.00915.57
7.1.310.0060.00615.70
7.1.300.0060.00615.89
7.1.290.0040.01115.71
7.1.280.0030.01015.59
7.1.270.0060.00616.02
7.1.260.0050.00515.82
7.1.250.0090.00015.91
7.1.240.0060.00915.79
7.1.230.0030.01015.89
7.1.220.0000.00815.54
7.1.210.0030.01015.69
7.1.200.0070.00515.90
7.1.190.0080.00315.85
7.1.180.0000.01015.84
7.1.170.0030.01015.81
7.1.160.0070.00415.67
7.1.150.0090.00315.77
7.1.140.0040.00415.85
7.1.130.0070.00715.80
7.1.120.0030.00615.95
7.1.110.0070.00715.87
7.1.100.0020.00816.97
7.1.90.0110.00315.90
7.1.80.0000.01215.60
7.1.70.0030.00816.56
7.1.60.0080.00817.47
7.1.50.0060.01116.26
7.1.40.0120.00015.78
7.1.30.0090.00315.62
7.1.20.0030.00715.96
7.1.10.0060.00615.65
7.1.00.0090.04619.04
7.0.330.0060.00615.45
7.0.320.0040.00815.64
7.0.310.0090.00315.34
7.0.300.0070.00715.44
7.0.290.0040.00715.43
7.0.280.0000.01315.41
7.0.270.0060.00315.51
7.0.260.0070.00715.47
7.0.250.0030.00915.57
7.0.240.0090.00315.51
7.0.230.0070.00415.52
7.0.220.0080.00415.34
7.0.210.0030.01015.14
7.0.200.0090.00216.20
7.0.190.0100.00315.53
7.0.180.0100.00615.30
7.0.170.0100.00315.55
7.0.160.0070.00315.19
7.0.150.0040.01115.59
7.0.140.0020.04218.78
7.0.130.0040.00415.50
7.0.120.0040.03718.84
7.0.110.0070.00715.60
7.0.100.0000.01515.26
7.0.90.0120.00315.29
7.0.80.0060.00915.32
7.0.70.0000.01515.24
7.0.60.0030.03817.66
7.0.50.0050.03316.74
7.0.40.0030.02716.92
7.0.30.0050.03116.87
7.0.20.0180.03316.75
7.0.10.0130.03816.87
7.0.00.0080.04316.79
5.6.400.0090.00614.34
5.6.390.0060.00614.39
5.6.380.0060.00614.05
5.6.370.0110.00414.36
5.6.360.0060.00914.51
5.6.350.0000.01314.04
5.6.340.0100.00714.56
5.6.330.0150.00014.61
5.6.320.0030.01014.59
5.6.310.0000.01414.41
5.6.300.0000.01714.43
5.6.290.0040.01214.28
5.6.280.0060.03617.58
5.6.270.0040.00814.49
5.6.260.0060.00614.46
5.6.250.0040.01114.55
5.6.240.0070.00714.39
5.6.230.0040.01214.31
5.6.220.0030.00914.61
5.6.210.0030.04317.45
5.6.200.0060.04316.35
5.6.190.0030.04717.43
5.6.180.0150.04617.47
5.6.170.0120.02617.41
5.6.160.0010.04617.56
5.6.150.0030.03216.32
5.6.140.0070.02216.39
5.6.130.0070.02216.26
5.6.120.0050.04617.69
5.6.110.0100.03517.61
5.6.100.0140.03417.74
5.6.90.0070.03117.73
5.6.80.0030.04717.43
5.6.70.0000.01014.63
5.6.60.0040.01114.20
5.6.50.0080.00414.42
5.6.40.0000.01114.36
5.6.30.0030.00614.37
5.6.20.0030.01414.49
5.6.10.0100.00014.28
5.6.00.0040.01114.41
5.5.380.0070.00414.32
5.5.370.0060.00914.36
5.5.360.0040.01414.34
5.5.350.0150.04317.44
5.5.340.0110.04016.13
5.5.330.0050.03017.32
5.5.320.0180.02517.32
5.5.310.0180.04517.42
5.5.300.0050.02816.27
5.5.290.0030.05016.17
5.5.280.0110.04217.63
5.5.270.0030.04317.57
5.5.260.0090.03317.40
5.5.250.0050.02217.41
5.5.240.0020.04517.19
5.5.230.0090.00614.38
5.5.220.0070.01014.27
5.5.210.0080.00414.39
5.5.200.0060.00914.29
5.5.190.0070.00714.18
5.5.180.0110.00314.32
5.5.170.0070.00714.36
5.5.160.0110.00314.55
5.5.150.0070.00414.36
5.5.140.0000.01114.41
5.5.130.0030.00714.10
5.5.120.0100.00313.98
5.5.110.0090.00614.47
5.5.100.0040.00413.92
5.5.90.0030.01314.50
5.5.80.0060.00314.55
5.5.70.0030.00714.46
5.5.60.0040.00814.10
5.5.50.0040.01114.21
5.5.40.0110.00414.16
5.5.30.0080.00614.45
5.5.20.0030.01014.36
5.5.10.0030.00614.46
5.5.00.0060.00614.29
5.4.450.0130.04015.38
5.4.440.0120.03915.27
5.4.430.0130.04015.45
5.4.420.0170.03615.53
5.4.410.0160.03015.33
5.4.400.0100.02915.21
5.4.390.0160.04015.24
5.4.380.0120.03215.09
5.4.370.0180.03315.24
5.4.360.0130.03315.28
5.4.350.0150.03715.09
5.4.340.0200.03315.24
5.4.330.0000.01111.32
5.4.320.0150.03715.38
5.4.310.0080.03815.10
5.4.300.0130.03115.20
5.4.290.0140.03615.21
5.4.280.0140.03015.27
5.4.270.0170.03515.15
5.4.260.0110.03815.10
5.4.250.0080.04215.08
5.4.240.0120.04015.29
5.4.230.0120.02315.19
5.4.220.0150.03815.18
5.4.210.0110.03615.27
5.4.200.0070.03015.20
5.4.190.0110.03315.27
5.4.180.0100.04315.13
5.4.170.0180.02815.22
5.4.160.0110.04315.20
5.4.150.0120.03515.23
5.4.140.0150.01513.83
5.4.130.0160.03213.89
5.4.120.0100.02013.87
5.4.110.0130.03713.89
5.4.100.0160.02313.92
5.4.90.0130.03513.84
5.4.80.0120.03613.93
5.4.70.0190.03213.88
5.4.60.0100.03013.85
5.4.50.0160.03313.95
5.4.40.0110.03813.83
5.4.30.0140.03713.88
5.4.20.0120.03713.92
5.4.10.0120.03913.88
5.4.00.0150.03713.53
5.3.290.0170.07014.65
5.3.280.0270.03314.63
5.3.270.0270.07014.70
5.3.260.0230.05314.59
5.3.250.0200.03714.60
5.3.240.0300.07014.54
5.3.230.0230.05714.61
5.3.220.0200.03314.49
5.3.210.0200.04014.58
5.3.200.0270.07014.59
5.3.190.0300.07014.63
5.3.180.0270.03714.70
5.3.170.0230.06714.80
5.3.160.0170.06714.60
5.3.150.0070.05714.57
5.3.140.0170.05014.47
5.3.130.0230.07314.49
5.3.120.0130.05014.49
5.3.110.0200.05014.46
5.3.100.0230.07714.29
5.3.90.0270.06314.15
5.3.80.0300.06314.25
5.3.70.0200.06313.94
5.3.60.0230.07314.24
5.3.50.0330.03714.04
5.3.40.0270.06013.87
5.3.30.0370.05313.97
5.3.20.0300.05713.63
5.3.10.0230.06713.75
5.3.00.0230.04713.71
5.2.170.0130.06312.13
5.2.160.0200.05712.13
5.2.150.0230.04012.13
5.2.140.0200.06312.13
5.2.130.0170.03012.13
5.2.120.0300.04712.13
5.2.110.0200.03712.13
5.2.100.0200.02712.13
5.2.90.0130.03012.13
5.2.80.0130.04712.13
5.2.70.0200.04012.13
5.2.60.0130.05012.13
5.2.50.0170.03012.13
5.2.40.0170.05012.13
5.2.30.0200.05312.13
5.2.20.0300.03312.13
5.2.10.0230.04312.13
5.2.00.0170.04712.13
5.1.60.0130.05012.13
5.1.50.0200.05012.13
5.1.40.0130.03012.13
5.1.30.0200.02712.13
5.1.20.0170.05312.13
5.1.10.0130.04012.13
5.1.00.0100.04312.13
5.0.50.0170.03712.13
5.0.40.0130.03712.13
5.0.30.0100.05312.13
5.0.20.0130.03012.13
5.0.10.0100.02712.13
5.0.00.0100.03312.13
4.4.90.0130.03312.13
4.4.80.0070.02312.13
4.4.70.0100.03012.13
4.4.60.0100.03012.13
4.4.50.0100.03312.13
4.4.40.0130.05012.13
4.4.30.0100.02712.13
4.4.20.0130.02012.13
4.4.10.0030.03312.13
4.4.00.0070.03012.13
4.3.110.0070.03712.13
4.3.100.0070.03712.13
4.3.90.0130.02312.13
4.3.80.0100.02712.13
4.3.70.0070.01312.13
4.3.60.0030.03312.13
4.3.50.0070.02712.13
4.3.40.0070.03712.13
4.3.30.0030.03712.13
4.3.20.0030.03012.13
4.3.10.0070.03012.13
4.3.00.0030.02712.13

preferences:
48.09 ms | 400 KiB | 5 Q