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.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<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;(</span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$bar</span><span style="color: #007700">)&nbsp;{<br />if&nbsp;(</span><span style="color: #0000BB">$bar&nbsp;</span><span style="color: #007700">===&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.0 - 5.0.4
<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 (</span><span style="color: #0000BB">$foo </span><span style="color: #007700">as </span><span style="color: #0000BB">$bar</span><span style="color: #007700">) {<br />if (</span><span style="color: #0000BB">$bar </span><span style="color: #007700">=== </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
<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;(</font><font color="#0000BB">$foo&nbsp;</font><font color="#007700">as&nbsp;</font><font color="#0000BB">$bar</font><font color="#007700">)&nbsp;{<br />if&nbsp;(</font><font color="#0000BB">$bar&nbsp;</font><font color="#007700">===&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
<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 (</font><font color="#0000BB">$foo </font><font color="#007700">as </font><font color="#0000BB">$bar</font><font color="#007700">) {<br />if (</font><font color="#0000BB">$bar </font><font color="#007700">=== </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>