3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function the_post($loop) { return '&lt;li class="'.(($loop % $columns) == 0 ? 'last' : (((($loop - 1) % $columns) == 0 ) ? 'first' : '')).'"&gt; &lt;/li&gt;'; } $loop = 2; $columns = 3; while ( $loop < 12 ){ echo the_post($loop); $loop++; }
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: columns in /in/Vsbqg on line 4 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/Vsbqg:4 Stack trace: #0 /in/Vsbqg(12): the_post(2) #1 {main} thrown in /in/Vsbqg on line 4
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt;&lt;li class="last"&gt; &lt;/li&gt;&lt;li class="last"&gt; &lt;/li&gt;
Output for 5.2.0 - 5.6.28
Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt;
Output for 5.0.4 - 5.1.6
Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt;
Output for 4.3.0 - 4.4.4, 5.0.0 - 5.0.3
Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt;
Output for 4.4.5 - 4.4.9
Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt; Notice: Undefined variable: columns in /in/Vsbqg on line 4 Warning: Division by zero in /in/Vsbqg on line 4 &lt;li class="last"&gt; &lt;/li&gt;