3v4l.org

run code in 300+ PHP versions simultaneously
<?php $File = new SplFileObject(__FILE__); echo 'First dump: Just cast as string', "\n"; echo htmlspecialchars((string) $File), "\n"; echo 'Ok, now let\'s iterate echoing out $line var created by foreach', "\n"; foreach($File as $line) { echo htmlspecialchars($line) , "\n"; } echo "\n"; echo 'Ok, now let\'s echo out the object as string again', "\n"; echo htmlspecialchars((string) $File), "\n";
Output for git.master, git.master_jit
First dump: Just cast as string &lt;?php Ok, now let's iterate echoing out $line var created by foreach &lt;?php $File = new SplFileObject(__FILE__); echo &#039;First dump: Just cast as string&#039;, &quot;\n&quot;; echo htmlspecialchars((string) $File), &quot;\n&quot;; echo &#039;Ok, now let\&#039;s iterate echoing out $line var created by foreach&#039;, &quot;\n&quot;; foreach($File as $line) { echo htmlspecialchars($line) , &quot;\n&quot;; } echo &quot;\n&quot;; echo &#039;Ok, now let\&#039;s echo out the object as string again&#039;, &quot;\n&quot;; echo htmlspecialchars((string) $File), &quot;\n&quot;; Ok, now let's echo out the object as string again Fatal error: Uncaught RuntimeException: Cannot read from file /in/anavZ in /in/anavZ:15 Stack trace: #0 /in/anavZ(15): SplFileObject->__toString() #1 {main} thrown in /in/anavZ on line 15
Process exited with code 255.
Output for rfc.property-hooks
First dump: Just cast as string &lt;?php Ok, now let's iterate echoing out $line var created by foreach &lt;?php $File = new SplFileObject(__FILE__); echo &#039;First dump: Just cast as string&#039;, &quot;\n&quot;; echo htmlspecialchars((string) $File), &quot;\n&quot;; echo &#039;Ok, now let\&#039;s iterate echoing out $line var created by foreach&#039;, &quot;\n&quot;; foreach($File as $line) { echo htmlspecialchars($line) , &quot;\n&quot;; } echo &quot;\n&quot;; echo &#039;Ok, now let\&#039;s echo out the object as string again&#039;, &quot;\n&quot;; echo htmlspecialchars((string) $File), &quot;\n&quot;; Ok, now let's echo out the object as string again
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:
34.67 ms | 402 KiB | 8 Q