3v4l.org

run code in 300+ PHP versions simultaneously
<?php $File = new SplFileObject(__FILE__); echo 'First dump: Just cast as string<br />'; echo '<pre>', htmlspecialchars((string) $File), '</pre>'; echo 'Ok, now let\'s iterate echoing out $line var created by foreach<br />'; echo '<pre>'; foreach($File as $line) { echo htmlspecialchars($line) . '<br />'; } echo '</pre>'; echo 'Ok, now let\'s echo out the object as string again'; echo '<pre>', htmlspecialchars((string) $File), '</pre>';
Output for git.master, git.master_jit
First dump: Just cast as string<br /><pre>&lt;?php </pre>Ok, now let's iterate echoing out $line var created by foreach<br /><pre>&lt;?php <br /> <br />$File = new SplFileObject(__FILE__); <br /> <br />echo &#039;First dump: Just cast as string&lt;br /&gt;&#039;; <br />echo &#039;&lt;pre&gt;&#039;, htmlspecialchars((string) $File), &#039;&lt;/pre&gt;&#039;; <br /> <br />echo &#039;Ok, now let\&#039;s iterate echoing out $line var created by foreach&lt;br /&gt;&#039;; <br />echo &#039;&lt;pre&gt;&#039;; <br />foreach($File as $line) { <br /> echo htmlspecialchars($line) . &#039;&lt;br /&gt;&#039;; <br />} <br />echo &#039;&lt;/pre&gt;&#039;; <br /> <br />echo &#039;Ok, now let\&#039;s echo out the object as string again&#039;; <br />echo &#039;&lt;pre&gt;&#039;, htmlspecialchars((string) $File), &#039;&lt;/pre&gt;&#039;;<br /></pre>Ok, now let's echo out the object as string again<pre> Fatal error: Uncaught RuntimeException: Cannot read from file /in/a8akj in /in/a8akj:16 Stack trace: #0 /in/a8akj(16): SplFileObject->__toString() #1 {main} thrown in /in/a8akj on line 16
Process exited with code 255.
Output for rfc.property-hooks
First dump: Just cast as string<br /><pre>&lt;?php </pre>Ok, now let's iterate echoing out $line var created by foreach<br /><pre>&lt;?php <br /> <br />$File = new SplFileObject(__FILE__); <br /> <br />echo &#039;First dump: Just cast as string&lt;br /&gt;&#039;; <br />echo &#039;&lt;pre&gt;&#039;, htmlspecialchars((string) $File), &#039;&lt;/pre&gt;&#039;; <br /> <br />echo &#039;Ok, now let\&#039;s iterate echoing out $line var created by foreach&lt;br /&gt;&#039;; <br />echo &#039;&lt;pre&gt;&#039;; <br />foreach($File as $line) { <br /> echo htmlspecialchars($line) . &#039;&lt;br /&gt;&#039;; <br />} <br />echo &#039;&lt;/pre&gt;&#039;; <br /> <br />echo &#039;Ok, now let\&#039;s echo out the object as string again&#039;; <br />echo &#039;&lt;pre&gt;&#039;, htmlspecialchars((string) $File), &#039;&lt;/pre&gt;&#039;;<br /></pre>Ok, now let's echo out the object as string again<pre>
Process exited with code 139.

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:
33.47 ms | 402 KiB | 8 Q