3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <!DOCTYPE html> <head> <meta charset="EUC-JP"> </head> <body> <h1>テスト文書</h1> <p>これはテスト用のHTMLです。EUC-JPと宣言しているのにShift_JISでエンコードされています。</p> </body> HTML; $html = mb_convert_encoding($html, 'SJIS-win'); // そのまま読み込むと当然文字化けする $doc = \Dom\HTMLDocument::createFromString($html, \Dom\HTML_NO_DEFAULT_NS); $xpath = new \Dom\XPath($doc); $node = $xpath->query("//h1")->item(0); var_dump($node->textContent); // 一度UTF-8にしてから、第3引数でエンコードを固定 $html = mb_convert_encoding($html, 'UTF-8', 'SJIS-win'); $doc = \Dom\HTMLDocument::createFromString($html, \Dom\HTML_NO_DEFAULT_NS, 'UTF-8'); $xpath = new \Dom\XPath($doc); $node = $xpath->query("//h1")->item(0); var_dump($node->textContent);

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.00.0120.00920.73
8.4.150.0030.00014.05
8.4.140.0150.00718.25
8.4.130.0130.00918.44
8.4.120.0100.00721.07
8.4.110.0100.01321.32
8.4.100.0070.00318.50
8.4.90.0130.00818.50
8.4.80.0090.00718.31
8.4.70.0110.00918.35
8.4.60.0140.00818.29
8.4.50.0090.00819.01
8.4.40.0130.00618.62
8.4.30.0060.01319.48
8.4.20.0140.00721.86
8.4.10.0110.01020.23
8.3.280.0160.00718.52
8.3.270.0150.00916.71
8.3.260.0120.00716.47
8.3.250.0120.00518.80
8.3.240.0060.00216.75
8.3.230.0110.01116.54
8.3.220.0150.00517.05
8.3.210.0050.00316.80
8.3.200.0110.00716.79
8.3.190.0130.00817.20
8.3.180.0050.00218.84
8.3.170.0130.00617.27
8.3.160.0160.00318.70
8.3.150.0040.01117.12
8.3.140.0120.00616.66
8.3.130.0060.01316.88
8.3.50.0070.01116.89
8.2.290.0030.00520.42
8.2.280.0100.00818.92
8.2.270.0070.01116.68
8.2.260.0070.01016.94
8.2.250.0040.01418.73
8.1.320.0120.00616.43

preferences:
54.33 ms | 403 KiB | 5 Q