3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $labels = array("Element1","Element2","Element3","Element4","Element5","Element6"); $i = 1; $str = ''; foreach($labels AS $label) { $str += "$label, "; if ($i % 2 == 0) { $str += "\n"; } $i++; } //Remove last 2 chars $str = substr($str,0,(strlen($str)-2)); echo $str; ?>
Output for 7.1.0
Warning: A non-numeric value encountered in /in/ljGIR on line 8 Warning: A non-numeric value encountered in /in/ljGIR on line 8 Warning: A non-numeric value encountered in /in/ljGIR on line 8 Warning: A non-numeric value encountered in /in/ljGIR on line 11 Warning: A non-numeric value encountered in /in/ljGIR on line 8 Warning: A non-numeric value encountered in /in/ljGIR on line 8 Warning: A non-numeric value encountered in /in/ljGIR on line 11 Warning: A non-numeric value encountered in /in/ljGIR on line 8 Warning: A non-numeric value encountered in /in/ljGIR on line 8 Warning: A non-numeric value encountered in /in/ljGIR on line 11
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.14