3v4l.org

run code in 300+ PHP versions simultaneously
<?php for ($x=1; $x<6; ++$x) { $unions[] = "SELECT " . ($x==1 ? "$x AS challenge_id, 1 as week_id" : "$x, 1"); $unions[] = "SELECT $x, 6"; } $derived_table = implode(' UNION ',$unions); ECHO $derived_table;

preferences:
37.66 ms | 402 KiB | 5 Q