3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.3.0 - 8.3.6
<h1>This is a test page from 3v4l.org </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> <pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"&lt;h1&gt;This is a test page from "</span><span style="color: #007700">.</span><span style="color: #0000BB">gethostname</span><span style="color: #007700">().</span><span style="color: #DD0000">" &lt;/h1&gt;"</span><span style="color: #007700">; </span><span style="color: #0000BB">$sum </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">; for (</span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">1</span><span style="color: #007700">; </span><span style="color: #0000BB">$i </span><span style="color: #007700">&lt;= </span><span style="color: #0000BB">10</span><span style="color: #007700">; </span><span style="color: #0000BB">$i</span><span style="color: #007700">++) { </span><span style="color: #0000BB">$sum </span><span style="color: #007700">+= </span><span style="color: #0000BB">$i</span><span style="color: #007700">; echo </span><span style="color: #DD0000">"+ ("</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">; } echo </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">; echo </span><span style="color: #DD0000">"&lt;h1&gt;If this opens correctly &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 adds variables to 55&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;then PHP5 has been successfully installed.&lt;/h1&gt;\n\n" </span><span style="color: #0000BB">?&gt;</span></code></pre>
Output for 7.3.32 - 7.3.33, 7.4.26 - 7.4.33, 8.0.13 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
<h1>This is a test page from 3v4l.org </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 7.1.26 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 8.0.0 - 8.0.12
<h1>This is a test page from phpShell </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 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.6
<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 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.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.3.11, 4.4.0 - 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

preferences:
234.5 ms | 401 KiB | 344 Q