3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo "<h1>This is a test page from ".gethostname()." </h1>"; $sum = 0; for ($i = 1; $i <= 10; $i++) { $sum += $i; echo "+ (".$i.")\n"; } echo "=\n[".$sum."]\n"; echo "<h1>If this opens correctly </h1>"."\n"."<h1>and adds variables to 55</h1>"." \n"."<h1>then PHP5 has been successfully installed.</h1>\n\n" ?> Below is the script used to output what you see above.<br><br> <?php highlight_string('<?php echo "<h1>This is a test page from ".gethostname()." </h1>"; $sum = 0; for ($i = 1; $i <= 10; $i++) { $sum += $i; echo "+ (".$i.")\n"; } echo "=\n[".$sum."]\n"; echo "<h1>If this opens correctly </h1>"."\n"."<h1>and adds variables to 55</h1>"." \n"."<h1>then PHP5 has been successfully installed.</h1>\n\n" ?>'); ?>
Output for 5.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
<h1>This is a test page from php_shell </h1>+ (1) + (2) + (3) + (4) + (5) + (6) + (7) + (8) + (9) + (10) = [55] <h1>If this opens correctly </h1> <h1>and adds variables to 55</h1> <h1>then PHP5 has been successfully installed.</h1> Below is the script used to output what you see above.<br><br> <code><span style="color: #000000"> <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"&lt;h1&gt;This&nbsp;is&nbsp;a&nbsp;test&nbsp;page&nbsp;from&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">gethostname</span><span style="color: #007700">().</span><span style="color: #DD0000">"&nbsp;&lt;/h1&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$sum&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;=&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$sum&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"+&nbsp;("</span><span style="color: #007700">.</span><span style="color: #0000BB">$i</span><span style="color: #007700">.</span><span style="color: #DD0000">")\n"</span><span style="color: #007700">;&nbsp;<br />}<br /><br />echo&nbsp;</span><span style="color: #DD0000">"=\n["</span><span style="color: #007700">.</span><span style="color: #0000BB">$sum</span><span style="color: #007700">.</span><span style="color: #DD0000">"]\n"</span><span style="color: #007700">;&nbsp;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;h1&gt;If&nbsp;this&nbsp;opens&nbsp;correctly&nbsp;&lt;/h1&gt;"</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;h1&gt;and&nbsp;adds&nbsp;variables&nbsp;to&nbsp;55&lt;/h1&gt;"</span><span style="color: #007700">.</span><span style="color: #DD0000">"&nbsp;\n"</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;h1&gt;then&nbsp;PHP5&nbsp;has&nbsp;been&nbsp;successfully&nbsp;installed.&lt;/h1&gt;\n\n"<br /></span><span style="color: #0000BB">?&gt;</span> </span> </code>
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.2.17
Fatal error: Call to undefined function gethostname() in /in/vQlEn on line 2
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: gethostname() in /in/vQlEn on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: gethostname() in /in/vQlEn on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: gethostname() in /in/vQlEn on line 2