3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("MAX",strlen("byebye")); const SENDOFF = "goodbye"; const START = 4; // position of "b" in goodbye $temp = SENDOFF; for ( $i = 0; $i < MAX; $i++ ){ $pos = START + ( $i % 3); $temp[$i] = SENDOFF[$pos]; } $temp{$i} = "\0"; printf("%s\n",$temp); // byebye

preferences:
57.02 ms | 402 KiB | 5 Q