3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_script_tags($html){ $dom = new DOMDocument(); $dom->loadHTML($html); $script = $dom->getElementsByTagName('script'); $remove = []; foreach($script as $item){ $remove[] = $item; } foreach ($remove as $item){ $item->parentNode->removeChild($item); } $html = $dom->saveHTML(); return $html; } $s = []; $s[] = "hey buddy what's up script"; $s[] = "Hi Friend <script>alert('hello world');</script>"; $s[] = "<script src=\"http://jquery.com\">joyjoy</script>happy"; foreach($s as $t){ echo $t.' ==> '.remove_script_tags($t)."\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
hey buddy what's up script ==> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p>hey buddy what's up script</p></body></html> Hi Friend <script>alert('hello world');</script> ==> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p>Hi Friend </p></body></html> <script src="http://jquery.com">joyjoy</script>happy ==> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head></head><body><p>happy</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.12 ms | 402 KiB | 8 Q