3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php highlight_string("<?php echo 'test'; foreach ($foo as $bar) { if ($bar === true) { echo 'true'; } } ");
Output for 5.0.5 - 5.2.2, 7.0.0 - 7.1.0
Notice: Undefined variable: foo in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 6 <code><span style="color: #000000"> <span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'test'</span><span style="color: #007700">;<br />foreach&nbsp;(&nbsp;as&nbsp;)&nbsp;{<br />if&nbsp;(&nbsp;===&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">)&nbsp;{<br />echo&nbsp;</span><span style="color: #DD0000">'true'</span><span style="color: #007700">;<br />}<br />}<br /></span> </span> </code>
Output for 5.2.3 - 5.6.28
Notice: Undefined variable: foo in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 6 Notice: Undefined variable: bar in /in/jElsA on line 10 <code><span style="color: #000000"> <span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'test'</span><span style="color: #007700">;<br />foreach&nbsp;(&nbsp;as&nbsp;)&nbsp;{<br />if&nbsp;(&nbsp;===&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">)&nbsp;{<br />echo&nbsp;</span><span style="color: #DD0000">'true'</span><span style="color: #007700">;<br />}<br />}<br /></span> </span> </code>
Output for 5.0.4
Notice: Undefined variable: foo in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 6 <code><span style="color: #000000"> <span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo </span><span style="color: #DD0000">'test'</span><span style="color: #007700">;<br />foreach ( as ) {<br />if ( === </span><span style="color: #0000BB">true</span><span style="color: #007700">) {<br />echo </span><span style="color: #DD0000">'true'</span><span style="color: #007700">;<br />}<br />}<br /></span> </span> </code>
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: foo in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 6 <code><span style="color: #000000"> <span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo </span><span style="color: #DD0000">'test'</span><span style="color: #007700">;<br />foreach ( as ) {<br />if ( === </span><span style="color: #0000BB">true</span><span style="color: #007700">) {<br />echo </span><span style="color: #DD0000">'true'</span><span style="color: #007700">;<br />}<br />}<br /></span> </span> </code>
Output for 4.4.0 - 4.4.9
Notice: Undefined variable: foo in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 6 <code><font color="#000000"> <font color="#0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">echo&nbsp;</font><font color="#DD0000">'test'</font><font color="#007700">;<br />foreach&nbsp;(&nbsp;as&nbsp;)&nbsp;{<br />if&nbsp;(&nbsp;===&nbsp;</font><font color="#0000BB">true</font><font color="#007700">)&nbsp;{<br />echo&nbsp;</font><font color="#DD0000">'true'</font><font color="#007700">;<br />}<br />}<br /></font> </font> </code>
Output for 4.3.0 - 4.3.11
Notice: Undefined variable: foo in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 5 Notice: Undefined variable: bar in /in/jElsA on line 6 <code><font color="#000000"> <font color="#0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">echo </font><font color="#DD0000">'test'</font><font color="#007700">;<br />foreach ( as ) {<br />if ( === </font><font color="#0000BB">true</font><font color="#007700">) {<br />echo </font><font color="#DD0000">'true'</font><font color="#007700">;<br />}<br />}<br /></font> </font> </code>