3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wrap_js($js) { $confirm_text = "It will not be possible to modify your responses anymore if you continue.\\n\\nAre you sure you want to continue?"; $new_js_start = 'if( window.confirm("' . $confirm_text . '") ) { '; $new_js_end = ' } else { event.preventDefault(); }'; return $new_js_start . $js . $new_js_end; } $html = "<input type='submit' id='gform_submit_button_4' class='gform_button button' value='Envoyer' onclick='/* Lots of JS */' onkeypress='/* Lots of JS */' />"; $doc = new DOMDocument(); $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($doc); foreach ($xpath->query("//input[@type='submit']") as $submit_input) { foreach (['onclick', 'onkeypress'] as $attribute) { if (($js = $submit_input->getAttribute($attribute)) != '') { $submit_input->setAttribute($attribute, wrap_js($js)); } } } echo $doc->saveHTML();
Output for git.master, git.master_jit, rfc.property-hooks
<input type="submit" id="gform_submit_button_4" class="gform_button button" value="Envoyer" onclick='if( window.confirm("It will not be possible to modify your responses anymore if you continue.\n\nAre you sure you want to continue?") ) { /* Lots of JS */ } else { event.preventDefault(); }' onkeypress='if( window.confirm("It will not be possible to modify your responses anymore if you continue.\n\nAre you sure you want to continue?") ) { /* Lots of JS */ } else { event.preventDefault(); }'>

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:
29.65 ms | 406 KiB | 5 Q