3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<p class="example">example</p> <p class="example" style="visibility:hidden">example</p> <script type="text/javascript">var example = 1 ....other stuff.... </script>'; $arr = explode(PHP_EOL, $str); //var_dump($arr); for($i = 0; $i < count($arr); $i++){ if(strpos("hidden", $arr[$i]) === false){ echo $arr[$i]; unset($arr[$i]); } if(strpos("<script", $arr[$i]) === false){ while(!strpos("</script", $arr[$i]) === false){ unset($arr[$i]); $i++; } } } $str = implode(PHP_EOL, $arr); echo $str; Echo substr_count(strip_tags($str), "example");

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.01016.88
8.3.50.0060.00916.50
8.3.40.0070.01118.93
8.3.30.0140.00018.45
8.3.20.0040.00420.34
8.3.10.0060.00323.65
8.3.00.0070.00317.72
8.2.180.0040.01517.00
8.2.170.0070.01422.96
8.2.160.0030.01420.52
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0030.00521.03
8.2.120.0080.00026.35
8.2.110.0030.00720.38
8.2.100.0080.00417.97
8.2.90.0040.00420.47
8.2.80.0080.00017.97
8.2.70.0040.00418.03
8.2.60.0060.00318.03
8.2.50.0030.00618.10
8.2.40.0000.00819.45
8.2.30.0040.00419.24
8.2.20.0000.00818.23
8.2.10.0070.00018.21
8.2.00.0070.00018.23
8.1.280.0070.00725.92
8.1.270.0080.00023.79
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00623.73
8.1.230.0060.00620.89
8.1.220.0080.00017.79
8.1.210.0000.01018.94
8.1.200.0060.00317.35
8.1.190.0040.00417.22
8.1.180.0050.00218.10
8.1.170.0040.00418.84
8.1.160.0050.00218.75
8.1.150.0070.00018.80
8.1.140.0040.00419.57
8.1.130.0000.00718.79
8.1.120.0000.00717.46
8.1.110.0060.00317.44
8.1.100.0000.00817.48
8.1.90.0000.00817.49
8.1.80.0000.00717.45
8.1.70.0030.00617.36
8.1.60.0040.00417.60
8.1.50.0040.00417.41
8.1.40.0050.00317.53
8.1.30.0040.00417.57
8.1.20.0070.00017.71
8.1.10.0000.00917.61
8.1.00.0080.00017.51
8.0.300.0050.00220.02
8.0.290.0040.00416.75
8.0.280.0070.00018.33
8.0.270.0000.00717.27
8.0.260.0040.00416.89
8.0.250.0000.00716.90
8.0.240.0000.00716.92
8.0.230.0000.00816.86
8.0.220.0000.00716.92
8.0.210.0000.00716.80
8.0.200.0040.00416.82
8.0.190.0000.01016.98
8.0.180.0020.00516.85
8.0.170.0060.00317.02
8.0.160.0000.00816.90
8.0.150.0050.00216.80
8.0.140.0050.00216.89
8.0.130.0050.00013.32
8.0.120.0040.00416.92
8.0.110.0000.00716.80
8.0.100.0030.00316.80
8.0.90.0050.00216.99
8.0.80.0100.00716.88
8.0.70.0040.00417.02
8.0.60.0000.00717.02
8.0.50.0000.00716.84
8.0.30.0090.01017.13
8.0.20.0130.01017.40
8.0.10.0000.00717.07
8.0.00.0120.01016.72
7.4.330.0020.00215.55
7.4.320.0030.00316.59
7.4.300.0030.00316.56
7.4.290.0080.00016.52
7.4.280.0000.00816.63
7.4.270.0030.00316.50
7.4.260.0030.00313.36
7.4.250.0000.00916.38
7.4.240.0040.00416.43
7.4.230.0030.00316.43
7.4.220.0090.00916.62
7.4.210.0040.01116.63
7.4.200.0000.00716.31
7.4.160.0110.00616.41
7.4.150.0130.00617.40
7.4.140.0090.00917.86
7.4.130.0150.00916.57
7.4.120.0150.00516.57
7.4.110.0070.01116.58
7.4.100.0150.00916.66
7.4.90.0080.00816.43
7.4.80.0100.00719.39
7.4.70.0070.01216.69
7.4.60.0130.00316.35
7.4.50.0100.00716.50
7.4.40.0110.00616.45
7.4.30.0090.01116.57
7.4.00.0070.01015.21
7.3.330.0000.00613.07
7.3.320.0060.00013.16
7.3.310.0030.00316.41
7.3.300.0000.00816.18
7.3.290.0080.00716.36
7.3.280.0080.00916.31
7.3.270.0090.00917.40
7.3.260.0080.01016.37
7.3.250.0080.01116.45
7.3.240.0110.00716.54
7.3.230.0050.01416.34
7.3.210.0080.00816.32
7.3.200.0160.00016.54
7.3.190.0140.00316.54
7.3.180.0090.00616.48
7.3.170.0080.00816.42
7.3.160.0100.00716.43
7.3.10.0040.01516.55
7.3.00.0000.01816.22
7.2.330.0060.01316.78
7.2.320.0060.01916.54
7.2.310.0090.00916.41
7.2.300.0220.00016.59
7.2.290.0060.01216.55
7.2.130.0170.00716.72
7.2.120.0060.01216.40
7.2.110.0030.01416.67
7.2.100.0070.01416.29
7.2.90.0030.01416.42
7.2.80.0090.01216.56
7.2.70.0160.00416.48
7.2.60.0150.00416.71
7.2.50.0160.00716.41
7.2.40.0140.00316.73
7.2.30.0040.01116.45
7.2.20.0140.00716.35
7.2.10.0060.01216.45
7.2.00.0090.00718.25
7.1.250.0090.00915.50
7.1.200.0030.01015.80
7.1.100.0040.00817.91
7.1.70.0000.01317.17
7.1.60.0290.00735.14
7.1.50.0210.01134.91
7.1.40.0220.01034.65
7.1.30.0210.01034.51
7.1.20.0230.01034.45
7.1.10.0070.00716.50
7.1.00.0040.01116.90
7.0.200.0030.01016.70
7.0.190.0060.00616.74
7.0.180.0030.01216.26
7.0.170.0070.00716.07
7.0.160.0040.01116.22
7.0.150.0060.00916.46
7.0.140.0060.00816.24
7.0.130.0090.00616.80
7.0.120.0100.00516.34
7.0.110.0070.01116.38
7.0.100.0060.01116.28
7.0.90.0090.00916.27
7.0.80.0100.01316.54
7.0.70.0070.01316.48
7.0.60.0120.00616.20
7.0.50.0090.01316.32
7.0.40.0070.00716.42
7.0.30.0050.01016.42
7.0.20.0070.00716.34
7.0.10.0040.01416.50
7.0.00.0120.00316.50

preferences:
51.21 ms | 400 KiB | 5 Q