3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<'HTML' <div class="blockImg imgRight"> <img src="customs/2/pictures/home.png"> <figcaption>Une légende</figcaption> </div> HTML; $dom = \Dom\HTMLDocument::createFromString($html, LIBXML_NOERROR); $divNode = $dom->querySelector('div.blockImg'); $classList = $divNode?->classList; if ($divNode and $classList->contains('imgRight') || $classList->contains('imgLeft')) { $class = $classList->contains('imgRight') ? 'imgRight' : 'imgLeft'; $src = $divNode->querySelector('img')->getAttribute('src'); $caption = $divNode->querySelector('figcaption')->textContent; echo $class, PHP_EOL, $src, PHP_EOL, $caption, PHP_EOL; }

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.30.0100.00719.89
8.5.20.0080.00920.41
8.5.10.0100.01017.11
8.5.00.0150.00620.39
8.4.180.0130.01020.21
8.4.170.0130.00825.45
8.4.160.0140.00724.06
8.4.150.0020.00014.05
8.4.140.0160.01317.79
8.4.130.0100.00718.16
8.4.120.0140.01020.62
8.4.110.0110.00819.08
8.4.100.0150.00918.34
8.4.90.0120.00918.13
8.4.80.0130.00918.36
8.4.70.0060.00518.31
8.4.60.0120.01219.93
8.4.50.0100.01218.48
8.4.40.0170.00317.94
8.4.30.0090.00919.22
8.4.20.0070.01421.43
8.4.10.0110.00618.13
8.3.300.0120.00820.82
8.3.290.0120.00720.75
8.3.280.0030.00014.05
8.3.270.0110.00816.68
8.3.260.0130.00616.82
8.3.250.0110.00818.95
8.3.240.0060.01016.50
8.3.230.0120.00816.60
8.3.220.0120.00617.13
8.3.210.0110.00816.80
8.3.200.0080.01118.95
8.3.190.0070.01016.99
8.3.180.0100.00818.68
8.3.170.0150.00416.96
8.3.160.0070.01118.38
8.3.150.0130.00717.28
8.3.140.0030.00616.58
8.3.130.0070.01116.50
8.3.50.0060.01316.55
8.2.300.0130.00618.14
8.2.290.0050.00920.41
8.2.280.0070.00618.50
8.2.270.0040.01516.59
8.2.260.0030.00618.46
8.2.250.0180.00016.55
8.1.340.0070.00517.85
8.1.320.0110.00816.41

preferences:
29.77 ms | 403 KiB | 5 Q