3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r($_POST); require_once "tcp_ping.class.php"; $pinger = new TcpPingWrapper(); $strAccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : ''; $strUA = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; if (strpos($strAccept, "application/xhtml+xml") !== false || stristr($strUA, "validator") !== false) { $content_type = 'application/xhtml+xml'; } else { $content_type = 'text/html'; } header("Content-Type: " . $content_type . "; charset=utf-8;"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>TCP Ping Example</title> <meta http-equiv="Content-Type" content="<?php echo $content_type?>; charset=utf-8;" /> <meta name="description" content="TCP Ping example by Andronicus Riyono" /> <meta name="keywords" content="andronicus, riyono, tcp ping, ping, tcp, php, sockets, socket" /> <style type="text/css"> body { font-family: "Trebuchet MS", Tahoma, Arial, Helvetica, sans-serif; } a img { border:0; } table, tr, th, td { border: 1px solid #039; border-collapse: collapse; } th, td { padding: .5em; } </style> </head> <body> <?php if (isset($_POST['multiple'])) { $_REQUEST['hosts'] = preg_split("/\s+/", $_POST['multiple'], 10, PREG_SPLIT_NO_EMPTY); } ?> <h1>Connectivity Ping</h1> <p>Enter up to 10 hostname or IP address you would like to ping on the textarea. One host or IP address per line. Hit the ping button to execute the TCP Connectivity Ping.</p> <p>The TCP Connectivity Ping will try to determine whether a host is alive or dead by sending NOOP Command to Common TCP Service (http, ftp, telnet, mail, in that order).</p> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <div><textarea id="multiple" name="multiple" rows="10" cols="40"><?php if (isset($_POST['multiple'])) { echo $_POST['multiple']; } ?></textarea></div> <div><input id="submit" name="submit" type="submit" value="Ping" /></div> </form> <?php if (isset($_REQUEST['hosts'])) { $pinger->ReadFormInput(); $pinger->Ping(); ?> <h2>Connectivity Ping Result</h2> <h3>Text only (&lt;pre&gt; is used here)</h3> <pre> <?php $pinger->DisplayOutputAsText(); ?> </pre> <h3>Ordinary HTML</h3> <?php $pinger->DisplayOutputAsHtml(); ?> <h3>Ordinary HTML table</h3> <?php $pinger->DisplayOutputAsHtmlTable(); ?> <h3>Fancy HTML table</h3> <?php $pinger->DisplayOutputAsHtmlFancy(); ?> <?php } ?> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://riyono.com/images/valid-xhtml10.png" alt="Valid XHTML 1.0!" height="15" width="80" /></a> </p> <address>Copyright (c) 2005 Andronicus Riyono &lt;nick@riyono.com&gt;</address> </body> </html>
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Array ( ) Warning: require_once(): open_basedir restriction in effect. File(tcp_ping.class.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/UtHMj on line 3 Warning: require_once(tcp_ping.class.php): Failed to open stream: Operation not permitted in /in/UtHMj on line 3 Fatal error: Uncaught Error: Failed opening required 'tcp_ping.class.php' (include_path='.:') in /in/UtHMj:3 Stack trace: #0 {main} thrown in /in/UtHMj on line 3
Process exited with code 255.
Output for 8.0.13
Array ( ) Warning: require_once(tcp_ping.class.php): Failed to open stream: No such file or directory in /in/UtHMj on line 3 Fatal error: Uncaught Error: Failed opening required 'tcp_ping.class.php' (include_path='.:') in /in/UtHMj:3 Stack trace: #0 {main} thrown in /in/UtHMj on line 3
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.3.32 - 7.3.33, 7.4.33
Array ( ) Warning: require_once(tcp_ping.class.php): failed to open stream: No such file or directory in /in/UtHMj on line 3 Fatal error: require_once(): Failed opening required 'tcp_ping.class.php' (include_path='.:') in /in/UtHMj on line 3
Process exited with code 255.
Output for 7.1.26 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
Array ( ) Warning: require_once(): open_basedir restriction in effect. File(tcp_ping.class.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/UtHMj on line 3 Warning: require_once(tcp_ping.class.php): failed to open stream: Operation not permitted in /in/UtHMj on line 3 Fatal error: require_once(): Failed opening required 'tcp_ping.class.php' (include_path='.:') in /in/UtHMj on line 3
Process exited with code 255.
Output for 7.1.20, 7.2.6 - 7.2.8
Array ( ) Warning: require_once(): open_basedir restriction in effect. File(tcp_ping.class.php) is not within the allowed path(s): (/tmp:/in) in /in/UtHMj on line 3 Warning: require_once(tcp_ping.class.php): failed to open stream: Operation not permitted in /in/UtHMj on line 3 Fatal error: require_once(): Failed opening required 'tcp_ping.class.php' (include_path='.:') in /in/UtHMj on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5
Array ( ) Warning: main(tcp_ping.class.php): failed to open stream: No such file or directory in /in/UtHMj on line 3 Fatal error: main(): Failed opening required 'tcp_ping.class.php' (include_path='.:') in /in/UtHMj on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Array ( ) Warning: main(tcp_ping.class.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/UtHMj on line 3 Fatal error: main() [http://www.php.net/function.main]: Failed opening required 'tcp_ping.class.php' (include_path='.:') in /in/UtHMj on line 3

preferences:
275.34 ms | 402 KiB | 384 Q