3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add_href_to_links($string) { $str = $string; $str = preg_replace("/([ \t]|^)www\./i", "\\1http://www.", $str); $str = preg_replace("/([ \t]|^)ftp\./i", "\\1ftp://ftp.", $str); $str = preg_replace("/(http:\/\/[^ )\r\n!]+)/i", "<a href=\"\\1\">\\1</a>", $str); $str = preg_replace("/(https:\/\/[^ )\r\n!]+)/i", "<a href=\"\\1\">\\1</a>", $str); $str = preg_replace("/(ftp:\/\/[^ )\r\n!]+)/i", "<a href=\"\\1\">\\1</a>", $str); $str = preg_replace("/([-a-z0-9_]+(\.[_a-z0-9-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)+))/i", "<a href=\"mailto:\\1\">\\1</a>", $str); $new_string = $str; return $new_string; } $str = 'שלום שלום\nhttps://www.youtube.com/watch?v=2w0JiLKQ3-o\n"asd" ש`מגניב'; $str=strip_tags($str,'<div><br><a><p><b><span>'); $str = str_replace('\r\n','',$str); $str = add_href_to_links($str); echo $str; ?>
Output for git.master, git.master_jit, rfc.property-hooks
שלום שלום\n<a href="https://www.youtube.com/watch?v=2w0JiLKQ3-o\n"asd"">https://www.youtube.com/watch?v=2w0JiLKQ3-o\n"asd"</a> ש`מגניב

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:
48.27 ms | 401 KiB | 8 Q