3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = '<var>One</var> <var>Two</var>'; // Works fine ($domA = new DOMDocument('1.0', 'UTF-8'))->loadHTML($a); foreach ((new DOMXPath($domA))->query('//var') as $var) { $var->replaceWith($domA->createElement('p', $var->nodeValue)); } var_dump($domA->saveHTML()); $b = '<var>One</var><var>Two</var>'; // Causes a 'double free' error ($domB = new DOMDocument('1.0', 'UTF-8'))->loadHTML($b); foreach ((new DOMXPath($domB))->query('//var') as $var) { $var->replaceWith($domB->createElement('p', $var->nodeValue)); } var_dump($domB->saveHTML());
Output for git.master, git.master_jit
string(155) "<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p>One</p> <p>Two</p></body></html> " string(158) "<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p>One</p><var>Two</var></body></html> " free(): double free detected in tcache 2
Process exited with code 134.
Output for rfc.property-hooks
string(155) "<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p>One</p> <p>Two</p></body></html> " string(154) "<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p>One</p><p>Two</p></body></html> "

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:
28.21 ms | 407 KiB | 5 Q