3v4l.org

run code in 300+ PHP versions simultaneously
<?php function findWord(String $html, String $searchWord): Bool { $dom = new DOMDocument; libxml_use_internal_errors(true); $dom->loadHTML($html); $htmlContent = $dom->getElementsByTagName('body')->item(0); $text = $htmlContent->textContent; return strpos($text, $searchWord) !== false; } // First let's start with html we know the word exists $html = <<<'HTML' <html> <head> <meta content="illustrative productions"> <script> var illustrative = true; </script> <style> .illustrative { background-color: #fff; } </style> </head> <body> <h1 class="illustrative">Hello World</h1> <p>Your search word appears here. <strong>illustrative</strong></p> </body> </html> HTML; // Gives us "Found" if (findWord($html, "illustrative")) { echo "Found"; } else { echo "Not Found"; } // Now let's try HTML we know the word doesn't exist $html = <<<'HTML' <html> <head> <meta content="illustrative productions"> <script> var illustrative = true; </script> <style> .illustrative { background-color: #fff; } </style> </head> <body> <h1 class="illustrative">Hello World</h1> <p>Your search word never appears here.</p> </body> </html> HTML; // Gives us "Not Found" if (findWord($html, "illustrative")) { echo "Found"; } else { echo "Not Found"; }

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.4.130.0140.00518.00
8.4.120.0130.00624.29
8.4.110.0120.00722.84
8.4.100.0150.00618.89
8.4.90.0040.00719.02
8.4.80.0050.00718.91
8.4.70.0110.00818.07
8.4.60.0040.00519.05
8.4.50.0040.00418.90
8.4.40.0100.01017.74
8.4.30.0050.00519.06
8.4.20.0170.00318.05
8.4.10.0080.00819.68
8.3.260.0060.00516.77
8.3.250.0100.00819.20
8.3.240.0030.00519.16
8.3.230.0080.01216.63
8.3.220.0120.00719.09
8.3.210.0090.01016.96
8.3.200.0040.00516.67
8.3.190.0080.00617.57
8.3.180.0100.00918.94
8.3.170.0060.01320.86
8.3.160.0110.00717.33
8.3.150.0100.01017.56
8.3.140.0030.00716.99
8.3.130.0000.00916.85
8.3.120.0090.00020.84
8.3.110.0070.00320.94
8.3.100.0080.00016.85
8.3.90.0050.00326.77
8.3.80.0030.00616.88
8.3.70.0110.01117.00
8.3.60.0080.00816.99
8.3.50.0050.01523.59
8.3.40.0090.00919.09
8.3.30.0060.00918.96
8.3.20.0040.00420.92
8.3.10.0080.00020.41
8.3.00.0050.00220.95
8.2.290.0090.01120.48
8.2.280.0130.00718.89
8.2.270.0060.00317.39
8.2.260.0050.00316.89
8.2.250.0030.00618.79
8.2.240.0080.00017.36
8.2.230.0040.00422.58
8.2.220.0070.01124.06
8.2.210.0050.00326.77
8.2.200.0030.00616.75
8.2.190.0150.00617.00
8.2.180.0160.00318.79
8.2.170.0100.00722.96
8.2.160.0000.01320.64
8.2.150.0100.00024.18
8.2.140.0080.00024.66
8.2.130.0030.00526.16
8.2.120.0050.00326.16
8.2.110.0040.00722.37
8.2.100.0080.00420.61
8.2.90.0110.00017.75
8.2.80.0000.00819.34
8.2.70.0060.00317.75
8.2.60.0040.00417.88
8.2.50.0040.00418.05
8.2.40.0030.00518.37
8.2.30.0040.00419.71
8.2.20.0050.00318.29
8.2.10.0000.00719.46
8.2.00.0000.00719.56
8.1.330.0120.00622.46
8.1.320.0120.00716.22
8.1.310.0080.00017.18
8.1.300.0060.00317.99
8.1.290.0030.00630.84
8.1.280.0000.01425.92
8.1.270.0030.00622.43
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0060.00322.61
8.1.230.0040.00819.54
8.1.220.0040.00417.91
8.1.210.0050.00518.77
8.1.200.0000.00917.60
8.1.190.0000.00817.60
8.1.180.0080.00018.10
8.1.170.0060.00317.63
8.1.160.0000.00719.24
8.1.150.0040.00419.00
8.1.140.0040.00419.01
8.1.130.0070.00020.25
8.1.120.0040.00417.64
8.1.110.0080.00317.64
8.1.100.0080.00017.64
8.1.90.0020.00517.62
8.1.80.0080.00017.67
8.1.70.0000.00717.59
8.1.60.0030.00717.82
8.1.50.0080.00017.75
8.1.40.0050.00317.70
8.1.30.0060.00317.87
8.1.20.0030.00617.87
8.1.10.0000.00817.83
8.1.00.0040.00417.77
8.0.300.0040.00421.80
8.0.290.0080.00017.13
8.0.280.0000.00818.61
8.0.270.0050.00318.25
8.0.260.0030.00320.37
8.0.250.0060.00317.22
8.0.240.0000.00817.16
8.0.230.0040.00417.23
8.0.220.0050.00317.21
8.0.210.0090.00017.21
8.0.200.0000.00717.07
8.0.190.0000.00817.16
8.0.180.0060.00317.13
8.0.170.0040.00417.03
8.0.160.0030.00517.16
8.0.150.0030.00717.03
8.0.140.0040.00617.09
8.0.130.0000.00513.59
8.0.120.0050.00317.12
8.0.110.0030.00517.21
8.0.100.0000.00817.05
8.0.90.0040.00417.20
8.0.80.0080.00617.03
8.0.70.0000.00817.19
8.0.60.0000.00817.12
8.0.50.0000.00716.98
8.0.30.0030.01417.56
8.0.20.0100.01117.34
8.0.10.0040.00417.24
8.0.00.0110.01417.13
7.4.330.0050.00015.55
7.4.320.0030.00316.67
7.4.300.0030.00316.82
7.4.290.0030.00516.77
7.4.280.0030.00516.61
7.4.270.0070.00016.74
7.4.260.0030.00313.63
7.4.250.0000.00816.80
7.4.240.0050.00316.78
7.4.230.0000.00816.85
7.4.220.0000.00716.74
7.4.210.0080.00916.82
7.4.200.0070.00016.51
7.4.130.0150.01016.91
7.4.120.0160.00816.64
7.4.110.0070.01116.72
7.4.100.0120.01216.77
7.4.90.0150.00316.89
7.4.80.0070.01119.39
7.4.70.0090.00916.86
7.4.60.0090.00916.81
7.4.50.0040.01516.74
7.4.40.0090.00916.83
7.4.20.0100.01316.74
7.4.10.0100.01316.84
7.4.00.0160.00616.87
7.3.330.0000.00716.63
7.3.320.0070.00013.43
7.3.310.0030.00316.59
7.3.300.0000.00716.64
7.3.290.0100.00716.56
7.3.280.0100.01016.53
7.3.260.0130.01016.55
7.3.240.0090.01116.62
7.3.230.0100.01016.54
7.3.210.0040.01316.64
7.3.200.0090.00916.82
7.3.190.0170.00016.72
7.3.180.0130.00616.61
7.3.170.0110.01116.69
7.3.160.0090.01216.59
7.3.140.0060.01616.71
7.3.130.0120.00616.73
7.3.120.0180.00816.68
7.3.110.0100.01016.69
7.3.100.0090.01316.46
7.3.90.0130.01216.77
7.3.80.0170.00716.57
7.3.70.0180.00416.45
7.3.60.0030.01316.61
7.3.50.0080.00816.64
7.3.40.0040.01416.54
7.3.30.0180.00616.69
7.3.20.0140.00916.63
7.3.10.0060.01216.62
7.3.00.0150.00316.64
7.2.330.0100.00717.06
7.2.320.0090.00917.00
7.2.310.0100.00716.72
7.2.300.0110.00816.63
7.2.290.0100.00617.01
7.2.270.0050.01816.59
7.2.260.0080.01116.89
7.2.250.0100.00716.91
7.2.240.0110.00816.78
7.2.230.0100.00916.85
7.2.220.0120.01216.96
7.2.210.0150.00916.85
7.2.200.0040.01816.75
7.2.190.0070.01017.01
7.2.180.0070.01016.68
7.2.170.0100.01416.75
7.2.160.0170.00516.86
7.2.150.0150.00716.95
7.2.140.0120.00916.72
7.2.130.0180.00016.81
7.2.120.0120.01216.89
7.2.110.0200.00016.73
7.2.100.0110.00716.91
7.2.90.0030.01716.74
7.2.80.0060.01116.80
7.2.70.0090.01216.96
7.2.60.0110.01116.93
7.2.50.0070.01716.70
7.2.40.0000.02116.66
7.2.30.0160.00316.95
7.2.20.0120.00916.56
7.2.10.0150.00916.77
7.2.00.0090.00916.88

preferences:
30.13 ms | 403 KiB | 5 Q