3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<table style="color:; text-align: left;"> <tr> <td> Processor: </td> <td> Intel Core 2 Duo - E8400 </td> </tr> <tr> <td> Clock speed: </td> <td> 3.0 GHz </td> </tr> <tr> <td> Memory: </td> <td> 4 GB </td> </tr> <tr> <td> Hard disk: </td> <td> 250 GB </td> </tr> <tr> <td> Video-adapter: </td> <td> VGA, Display </td> </tr> <tr> <td> Netwerk card: </td> <td> 1000 Mbps LAN </td> </tr> <tr> <td> Optical drive: </td> <td> DVD-Rewriter </td> </tr> <tr> <td> Operating system: </td> <td> Windows 7 or 10 Pro </td> </tr> <tr> <td> Warranty: </td> <td> 1 year </td> </tr> </table>'; $err = libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML($html); libxml_clear_errors(); libxml_use_internal_errors($err); // $result = []; foreach ($dom->getElementsByTagName('td') as $i => $tr) { if ($i % 2 == 0) { $key = strtolower(trim($tr->nodeValue)); $key = str_replace('-', ' ', trim($key, ':')); } else { $result[$key] = trim($tr->nodeValue); } } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [processor] => Intel Core 2 Duo - E8400 [clock speed] => 3.0 GHz [memory] => 4 GB [hard disk] => 250 GB [video adapter] => VGA, Display [netwerk card] => 1000 Mbps LAN [optical drive] => DVD-Rewriter [operating system] => Windows 7 or 10 Pro [warranty] => 1 year )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
128.21 ms | 406 KiB | 5 Q