3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "<input type=\"text\">\n<img src=\"\"><a href=\"\"><button type=\"button\"></button><div id=\"some\"></div><p></p>"; var_dump(removeTags($str, array('img'))); /** * Strip only certain tags in the given HTML string * @return String */ function removeTags($html, $tags){ $existing_tags = getAllTagNames($html); $allowable_tags = '<'.implode('><', array_diff($existing_tags, $tags)).'>'; return strip_tags($html, $allowable_tags); } /** * Get a list of tag names in the provided HTML string * @return Array */ function getAllTagNames($html){ $tags = array(); $part = explode("<", $html); foreach($part as $tag){ $chunk = explode(" ", $tag); if(empty($chunk[0]) || $chunk[0][0] == "/") continue; $tag = trim($chunk[0], " >"); if(!in_array($tag, $tags)) $tags[] = $tag; } return $tags; }

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.0150.00618.68
8.3.50.0150.00318.31
8.3.40.0090.00918.84
8.3.30.0110.00718.84
8.3.20.0070.00020.21
8.3.10.0000.00820.98
8.3.00.0080.00019.04
8.2.180.0150.00618.53
8.2.170.0040.01222.96
8.2.160.0150.00319.32
8.2.150.0180.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00821.08
8.2.110.0050.00720.98
8.2.100.0040.00817.97
8.2.90.0030.00517.63
8.2.80.0000.00817.97
8.2.70.0060.00317.93
8.2.60.0030.00518.34
8.2.50.0070.00418.10
8.2.40.0040.00422.35
8.2.30.0030.00519.22
8.2.20.0000.00818.15
8.2.10.0080.00018.22
8.2.00.0080.00018.07
8.1.280.0120.00925.92
8.1.270.0030.00524.66
8.1.260.0110.00026.35
8.1.250.0050.00228.09
8.1.240.0030.00623.74
8.1.230.0140.00019.02
8.1.220.0040.00417.74
8.1.210.0080.00021.02
8.1.200.0060.00317.36
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0050.00318.64
8.1.160.0000.00719.06
8.1.150.0070.00018.88
8.1.140.0040.00419.68
8.1.130.0040.00418.87
8.1.120.0040.00417.52
8.1.110.0050.00217.43
8.1.100.0080.00017.38
8.1.90.0050.00217.42
8.1.80.0000.00817.52
8.1.70.0040.00417.48
8.1.60.0030.00517.67
8.1.50.0060.00317.60
8.1.40.0000.00717.54
8.1.30.0080.00017.65
8.1.20.0040.00417.68
8.1.10.0040.00417.57
8.1.00.0020.00517.50
8.0.300.0070.00019.61
8.0.290.0040.00416.75
8.0.280.0050.00318.52
8.0.270.0070.00017.29
8.0.260.0000.00718.91
8.0.250.0030.00316.99
8.0.240.0030.00717.00
8.0.230.0000.00716.92
8.0.220.0000.00716.94
8.0.210.0030.00516.96
8.0.200.0000.00716.99
8.0.190.0000.00716.88
8.0.180.0050.00216.84
8.0.170.0040.00416.93
8.0.160.0040.00417.01
8.0.150.0000.00716.87
8.0.140.0040.00416.88
8.0.130.0030.00313.31
8.0.120.0000.00716.89
8.0.110.0000.00716.93
8.0.100.0040.00416.98
8.0.90.0030.00516.78
8.0.80.0100.01016.88
8.0.70.0090.00016.74
8.0.60.0030.00516.78
8.0.50.0000.00816.94
8.0.30.0110.00717.14
8.0.20.0120.00917.40
8.0.10.0040.00416.84
8.0.00.0090.00816.93
7.4.330.0000.00615.55
7.4.320.0000.00716.59
7.4.300.0000.00616.67
7.4.290.0000.00716.64
7.4.280.0000.00816.52
7.4.270.0050.00316.45
7.4.260.0030.00316.45
7.4.250.0030.00316.60
7.4.240.0000.00816.53
7.4.230.0030.00316.70
7.4.220.0030.01716.64
7.4.210.0050.01316.67
7.4.200.0000.00716.43
7.4.160.0020.01416.55
7.4.150.0090.00817.40
7.4.140.0090.01017.86
7.4.130.0090.01616.68
7.4.120.0110.01016.45
7.4.110.0110.01416.44
7.4.100.0130.00316.56
7.4.90.0080.00816.53
7.4.80.0110.00719.39
7.4.70.0080.00816.51
7.4.60.0070.01016.66
7.4.50.0120.00216.47
7.4.40.0090.00916.39
7.4.30.0070.01016.66
7.4.20.0060.00916.70
7.4.10.0120.00316.73
7.4.00.0070.00715.28
7.3.330.0060.00013.25
7.3.320.0030.00313.34
7.3.310.0040.00416.40
7.3.300.0000.00616.38
7.3.290.0100.00616.39
7.3.280.0080.00816.35
7.3.270.0130.00417.40
7.3.260.0120.00416.43
7.3.250.0120.00616.38
7.3.240.0090.00916.44
7.3.230.0090.00916.44
7.3.210.0060.00916.34
7.3.200.0090.00616.59
7.3.190.0100.00716.46
7.3.180.0100.00716.55
7.3.170.0060.00916.52
7.3.160.0130.00316.51
7.3.140.0000.01616.50
7.3.130.0060.00916.53
7.3.120.0080.00615.54
7.3.110.0100.00715.19
7.3.100.0080.01115.01
7.3.90.0070.00815.12
7.3.80.0080.00815.06
7.3.70.0090.00515.00
7.3.60.0100.00714.98
7.3.50.0070.01114.88
7.3.40.0080.00814.94
7.3.30.0070.00814.85
7.3.20.0610.00715.03
7.3.10.0520.00715.07
7.3.00.0540.00615.07
7.2.330.0090.00916.86
7.2.320.0030.01516.53
7.2.310.0090.00916.84
7.2.300.0060.01116.82
7.2.290.0040.01216.81
7.2.270.0120.00316.69
7.2.260.0030.01216.62
7.2.250.0060.01415.73
7.2.240.0090.00715.41
7.2.230.0070.01115.22
7.2.220.0090.00715.29
7.2.210.0080.00815.32
7.2.200.0090.00815.35
7.2.190.0080.00915.22
7.2.180.0100.00915.13
7.2.170.0090.00715.22
7.2.160.0090.01015.12
7.2.150.0640.00715.41
7.2.140.0550.00915.32
7.2.130.0670.00715.28
7.2.120.0680.00815.33
7.2.110.0610.00515.28
7.2.100.0480.00915.28
7.2.90.0490.00715.27
7.2.80.0560.00715.26
7.2.70.0540.00915.25
7.2.60.0470.00815.39
7.2.50.0540.00915.24
7.2.40.0530.00915.36
7.2.30.0410.01015.24
7.2.20.0440.00815.25
7.2.10.0550.00815.30
7.2.00.0430.00815.70
7.1.330.0100.00814.91
7.1.320.0100.00714.50
7.1.310.0100.00714.42
7.1.300.0110.00714.32
7.1.290.0200.00714.35
7.1.280.0100.00714.26
7.1.270.0390.00414.19
7.1.260.0460.00814.23
7.1.250.0590.00714.15
7.1.240.0720.01014.10
7.1.230.0660.01014.07
7.1.220.0610.00914.05
7.1.210.0650.00714.08
7.1.200.0550.00814.15
7.1.190.0520.00914.03
7.1.180.0540.00714.03
7.1.170.0600.01014.07
7.1.160.0520.00714.04
7.1.150.0540.00814.08
7.1.140.0530.00914.05
7.1.130.0530.00814.03
7.1.120.0480.00714.47
7.1.110.0360.00814.46
7.1.100.0440.00914.40
7.1.90.0560.00614.38
7.1.80.0390.00814.37
7.1.70.0320.00914.28
7.1.60.0380.01118.56
7.1.50.0360.00918.50
7.1.40.0350.00818.31
7.1.30.0340.01018.37
7.1.20.0360.00918.48
7.1.10.0280.01014.17
7.1.00.0320.00914.17
7.0.330.0740.00713.60
7.0.320.0660.00813.65
7.0.310.0560.00813.65
7.0.300.0430.00813.65
7.0.290.0500.00813.71
7.0.280.0560.00613.65
7.0.270.0540.00713.66
7.0.260.0450.01014.14
7.0.250.0510.00814.06
7.0.240.0490.00914.11
7.0.230.0490.00814.09
7.0.220.0370.00814.08
7.0.210.0320.00913.87
7.0.200.0390.00813.92
7.0.190.0360.00713.89
7.0.180.0290.00713.83
7.0.170.0310.00713.83
7.0.160.0350.00913.88
7.0.150.0340.00613.88
7.0.140.0320.00813.85
7.0.130.0320.00913.88
7.0.120.0530.00813.93
7.0.110.0350.00713.80
7.0.100.0360.01013.86
7.0.90.0320.00713.92
7.0.80.0290.00813.84
7.0.70.0300.00913.77
7.0.60.0500.00813.82
7.0.50.0280.00713.88
7.0.40.0300.00813.93
7.0.30.0320.00913.94
7.0.20.0560.00913.89
7.0.10.0310.00713.76
7.0.00.0470.00713.91
5.6.400.0110.00914.50
5.6.390.0080.01114.51
5.6.380.0110.00914.51
5.6.370.0110.00816.26
5.6.360.0110.01015.97
5.6.350.0040.01616.03
5.6.340.0050.01415.91
5.6.330.0030.02015.89
5.6.320.0050.01416.11
5.6.310.0060.01415.73
5.6.300.0150.00516.13
5.6.290.0140.00615.78
5.6.280.0150.00515.72
5.6.270.0140.01215.96
5.6.260.0180.00615.82
5.6.250.0110.00916.08
5.6.240.0110.00815.77
5.6.230.0090.00915.95
5.6.220.0120.00715.78
5.6.210.0170.00915.81
5.6.200.0100.01015.63
5.6.190.0070.01315.86
5.6.180.0060.01215.75
5.6.170.0110.00715.91
5.6.160.0100.01015.62
5.6.150.0140.00715.74
5.6.140.0090.01415.87
5.6.130.0030.01515.75
5.6.120.0100.01015.64
5.6.110.0130.00415.72
5.6.100.0130.00615.90
5.6.90.0080.00915.75
5.6.80.0140.00315.59
5.6.70.0140.00415.86
5.6.60.0080.00815.66
5.6.50.0120.00415.63
5.6.40.0190.00015.75
5.6.30.0090.01515.61
5.6.20.0130.00515.62
5.6.10.0050.01415.66
5.6.00.0070.01115.49
5.5.380.0080.01115.70
5.5.370.0080.01115.74
5.5.360.0070.01015.52
5.5.350.0040.01715.91
5.5.340.0150.00515.69
5.5.330.0180.00015.88
5.5.320.0000.01815.93
5.5.310.0000.01815.74
5.5.300.0030.01915.75
5.5.290.0140.00815.73
5.5.280.0040.01215.88
5.5.270.0080.01115.86
5.5.260.0200.00015.63
5.5.250.0090.01215.68
5.5.240.0150.00415.66
5.5.230.0090.00915.77
5.5.220.0090.00915.75
5.5.210.0040.01515.67
5.5.200.0070.01115.66
5.5.190.0140.00515.83
5.5.180.0130.01015.89
5.5.170.0110.00515.59
5.5.160.0080.01115.54
5.5.150.0040.02215.67
5.5.140.0100.01015.72
5.5.130.0090.01215.71
5.5.120.0110.01115.53
5.5.110.0140.00715.63
5.5.100.0130.00915.88
5.5.90.0090.01315.97
5.5.80.0130.00815.45
5.5.70.0030.01815.64
5.5.60.0070.01115.73
5.5.50.0150.00415.70
5.5.40.0110.01215.81
5.5.30.0070.01315.63
5.5.20.0030.02115.39
5.5.10.0100.01015.64
5.5.00.0170.00215.65
5.4.450.0080.00812.77
5.4.440.0080.00812.84
5.4.430.0100.00612.92
5.4.420.0090.00712.91
5.4.410.0120.00412.97
5.4.400.0090.00912.77
5.4.390.0140.00412.89
5.4.380.0080.00812.72
5.4.370.0140.00312.77
5.4.360.0080.00812.77
5.4.350.0130.00312.68
5.4.340.0070.01012.74
5.4.330.0110.00712.80
5.4.320.0100.00712.86
5.4.310.0110.00712.83
5.4.300.0120.00912.99
5.4.290.0170.00312.88
5.4.280.0040.01712.82
5.4.270.0110.00612.71
5.4.260.0190.00512.97
5.4.250.0100.00712.82
5.4.240.0090.01212.90
5.4.230.0090.00812.75
5.4.220.0050.01112.89
5.4.210.0140.00412.61
5.4.200.0090.01212.89
5.4.190.0090.00912.76
5.4.180.0120.00512.66
5.4.170.0100.00612.71
5.4.160.0090.00912.99
5.4.150.0110.00612.90
5.4.140.0090.00612.75
5.4.130.0090.00912.81
5.4.120.0150.00612.72
5.4.110.0090.00912.79
5.4.100.0150.02212.92
5.4.90.0160.00012.71
5.4.80.0140.00312.82
5.4.70.0080.01112.92
5.4.60.0060.01212.92
5.4.50.0140.00512.84
5.4.40.0080.00812.70
5.4.30.0080.01212.88
5.4.20.0120.00612.77
5.4.10.0080.00812.86
5.4.00.0080.00812.86
5.3.290.0100.01313.20
5.3.280.0110.00813.15
5.3.270.0140.00413.34
5.3.260.0100.01013.15
5.3.250.0110.00713.24
5.3.240.0130.00412.99
5.3.230.0130.00913.12
5.3.220.0120.00612.91
5.3.210.0120.00613.03
5.3.200.0060.01113.10
5.3.190.0090.00913.00
5.3.180.0150.00913.30
5.3.170.0090.01213.16
5.3.160.0120.00613.21
5.3.150.0150.00413.24
5.3.140.0130.00513.23
5.3.130.0090.00913.08
5.3.120.0090.00913.12
5.3.110.0090.00913.07
5.3.100.0080.01213.10
5.3.90.0040.01313.36
5.3.80.0150.00413.13
5.3.70.0150.00213.02
5.3.60.0040.01313.16
5.3.50.0080.00813.09
5.3.40.0140.00813.09
5.3.30.0070.01113.13
5.3.20.0070.01012.99
5.3.10.0130.00612.80
5.3.00.0070.01012.79
5.2.170.0100.00512.09
5.2.160.0060.00612.02
5.2.150.0080.00412.30
5.2.140.0090.00412.14
5.2.130.0100.00211.92
5.2.120.0050.00911.93
5.2.110.0150.00311.96
5.2.100.0070.00612.03
5.2.90.0070.00711.91
5.2.80.0020.01011.83
5.2.70.0100.00511.90
5.2.60.0110.00311.93
5.2.50.0050.00911.74
5.2.40.0060.00911.97
5.2.30.0070.01111.90
5.2.20.0060.00911.89
5.2.10.0100.01011.74
5.2.00.0040.01111.58
5.1.60.0110.00511.37
5.1.50.0040.01111.37
5.1.40.0070.00711.37
5.1.30.0150.00311.37
5.1.20.0100.00711.37
5.1.10.0100.01011.37
5.1.00.0080.01211.37
5.0.50.0040.00811.37
5.0.40.0050.00511.37
5.0.30.0080.00311.37
5.0.20.0040.00811.37
5.0.10.0070.00811.37
5.0.00.0080.00311.37
4.4.90.0050.00211.37
4.4.80.0070.00011.37
4.4.70.0040.00411.37
4.4.60.0040.00411.37
4.4.50.0050.00511.37
4.4.40.0060.00011.37
4.4.30.0000.00611.37
4.4.20.0040.00411.37
4.4.10.0060.00011.37
4.4.00.0000.00611.37
4.3.110.0030.00311.37
4.3.100.0050.00211.37
4.3.90.0000.00711.37
4.3.80.0050.00211.37
4.3.70.0000.00611.37
4.3.60.0030.00311.37
4.3.50.0070.00011.37
4.3.40.0000.00611.37
4.3.30.0030.00311.37
4.3.20.0030.00311.37
4.3.10.0030.00311.37
4.3.00.0000.00511.37

preferences:
91.31 ms | 401 KiB | 5 Q