3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $width = 5; foreach (range(1, $width) as $i) { printf("%{$width}s\n", join(array_reverse(range(1, $i)))); } $width = 5; foreach (range(1, $width) as $i) { printf("%{$width}s\n", join(array(range(1, $i)))); }
based on OhgJQ
Output for 4.3.0 - 7.2.0
1 21 321 4321 54321 Notice: Array to string conversion in /in/hL4I4 on line 11 Array Notice: Array to string conversion in /in/hL4I4 on line 11 Array Notice: Array to string conversion in /in/hL4I4 on line 11 Array Notice: Array to string conversion in /in/hL4I4 on line 11 Array Notice: Array to string conversion in /in/hL4I4 on line 11 Array