3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f( $str ){ $l = strlen($str); for( $i = -$l; $i < $l; $i++ ){ $I = abs($i); $s = substr($str,$I); echo str_repeat(',',$I) . strrev($s) . $s . "\n"; } } echo "------------\n"; f(".desserts"); echo "------------\n";

preferences:
17.87 ms | 402 KiB | 5 Q