3v4l.org

run code in 300+ PHP versions simultaneously
<?php //error_reporting(0); //session_start(); function array_to_string($array) { $retval = ''; foreach ($array as $index => $value) { $retval .= urlencode(base64_encode($index)) . '|' . urlencode(base64_encode($value)) . '||'; } return urlencode(substr($retval, 0, -2)); } function string_to_array($string) { $retval = array(); $string = urldecode($string); $tmp_array = explode('||', $string); foreach ($tmp_array as $tmp_val) { list($index, $value) = explode('|', $tmp_val); $retval[base64_decode(urldecode($index))] = base64_decode(urldecode($value)); } return $retval; } function parse_smileys($string) { $smileylist = array(); $i = 0; if ($handle = opendir('./smileys/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "Thumbs.db") { $smileylist[$i] = str_replace(".gif", "", $file); $i++; } } closedir($handle); } foreach ($smileylist as $smileycheck) { $string = str_replace(":".$smileycheck.":", "<img src=\"smileys/".$smileycheck.".gif\" />", $string); } return $string; } function is_url($url){ // http, https. ftp $regex = "`^(https?://|ftp://)(([0-9a-z_!~*'().&=+$%-]+:)?[0-9a-z_!~*'().&=+$%-]+@)?" . //user@ "(([0-9]{1,3}\.){3}[0-9]{1,3}" . // IP "|" . // allows either IP or domain "([0-9a-z_!~*'()-]+\.)*" . // tertiary domain(s) "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." . // second level domain "[a-z]{2,6})" . // first level domain "(:[0-9]{1,4})?" . // port number "((/?)|" . // a slash isn't required if there is no file name "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$`"; //filename // www. $regex2 = "`^(www\.)(" . //www. "([0-9a-z_!~*'()-]+\.)*" . // tertiary domain(s) "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." . // second level domain "[a-z]{2,6})" . // first level domain "(:[0-9]{1,4})?" . // port number "((/?)|" . // a slash isn't required if there is no file name "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$`"; //filename return (preg_match($regex, $url) || preg_match($regex2, $url)); } function is_email($email){ $regex = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$^"; return preg_match($regex, $email); } function parse_links($msg) { $words = explode(" ", $msg); $new = array(); foreach($words as $word) { if(is_url($word)) if(substr($word,0,4)=="www.") $word = "<a href=\%22http:/%22.$word.%22\%22 target=\"_blank\">[link]</a>"; else $word = "<a href=\"".$word."\" target=\"_blank\">[link]</a>"; if(is_email($word)) $word = "<a href=\"mailto:".$word."\" target=\"_blank\">[mail]</a>"; $new[] = $word; } return implode(" ", $new); } function show(){ include("./config.php"); include("./lang.php"); $lines = file("./db.txt"); $numlines = count($lines); echo'<div class="tagcount">'; if($numlines=="1"){ echo "<center>(".str_replace("%1",$numlines,$lang["numtag"]).""; if($users_online_enabled){ echo ' | '; include("./online.php");} echo ")</center>\n"; } else { echo "<center>(".str_replace("%1",$numlines,$lang["numtags"]).""; if($users_online_enabled){ echo ' | '; include("./online.php");} echo ")</center>\n"; } echo'</div>'; if ($numtags >= $numlines) { $i = 0; } else { $i = $numlines - $numtags; } if($reverse_posts) { $lines = array_reverse($lines); $i = 0; } $ab = 0; while( $i < $numlines ) { if($reverse_posts && ($i > $numtags - 1)) { $i = $numlines + 1; } else { $thistag = string_to_array($lines[$i]); $thistag[4] = parse_smileys($thistag[4]); if(!$thistag[2] || ($thistag[2]=="http://")) { $thistag[2] = "<a href=\"#\">"; } else { $thistag[2] = "<a href=\"".$thistag[2]."\" target=\"_blank\">"; } if($timestamps_enabled&&$thistag[5]) { $timestamp = date($timestamp_format,$thistag[5])." &raquo;"; } else { $timestamp=""; } if($linkparsing) { $message = parse_links(stripslashes($thistag[4])); } else { $message = stripslashes($thistag[4]); } if(!$ab) { echo "<div class=\"taga\"><small>".$timestamp."</small>".$thistag[2]."".stripslashes($thistag[1])."</a> &raquo; ".$message."</div>\n"; $ab = 1; } else { echo "<div class=\"tagb\"><small>".$timestamp."</small>".$thistag[2].stripslashes($thistag[1])."</a> &raquo; ".$message."</div>\n"; $ab = 0; } } $i++; } //######################################################################## if($users_ip_enabled) { echo "<center>".$lang["usersip"]."<span class=\"ip\">".$_SERVER['REMOTE_ADDR']."</span></center>"; } if(!$users_ip_enabled) { echo ""; } if($admin_status_enabled){ //session_start(); if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']==md5(md5($adminpass))) { echo "<center>".$lang["adminstatus"]."<span class=\"admin_online\"> ".$lang["adminonline"]."</span></center>"; }else{ echo "<center>".$lang["adminstatus"]."<span class=\"admin_offline\"> ".$lang["adminoffline"]."</span></center>"; } }else{ if($users_ip_enabled) { echo "</center>"; } } if($powered_by_enabled_bottom){ echo "<center>".$lang["poweredby"]."<a target=\"_blank\" href=".$lang["poweredurl"].">tagBox ".$versie."</a></center>"; } //######################################################################## } function main() { //session_start(); echo '<!DOCTYPE html>'; //echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'."\n"; echo '<html>'."\n"; echo '<head>'."\n"; echo '<title>Tagbox</title>'."\n"; echo '<link rel="stylesheet" type="text/css" href="default.css">'."\n"; echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'."\n"; echo '<script type="text/javascript"> function createRequestObject(){ var request_; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ request_ = new ActiveXObject("Microsoft.XMLHTTP"); }else{ request_ = new XMLHttpRequest(); } return request_; } var http = new Array(); var http2 = new Array(); function getInfo(){ var curDateTime = new Date(); http[curDateTime] = createRequestObject(); http[curDateTime].open(\'get\', \'refresh.php\'); http[curDateTime].onreadystatechange = function(){ if (http[curDateTime].readyState == 4) { if (http[curDateTime].status == 200 || http[curDateTime].status == 304) { var response = http[curDateTime].responseText; document.getElementById(\'view_ajax\').innerHTML = response; } } } http[curDateTime].send(null); } function go(){ window.scrollTo(0,0); getInfo(); window.setTimeout("go()", 5000); } </script>'."\n"; echo '</head>'."\n"; echo '<body onLoad="go()">'."\n"; echo '<center><div id="view_ajax"></div></center>'."\n"; echo '</body>'."\n"; echo '</html>'; } ?>
Output for git.master, git.master_jit, rfc.property-hooks

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