Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $arr = array();
- $arr = array_fill(0, $size, array());
- for ($i = 0; $i < count($arr); $i++) {
- $arr[$i] = array_fill(0, $size, '|');
- }
- $str = 'Rvioes roi tset ';
- $index = 0;
- $row = 0;
- $col = 0;
- while ($index < $size * $size) {
- while ($arr[$row][$col] == '|' && $col < $size) {
- $arr[$row][$col++] = $str[$index++ % strlen($str)];
- }
- $row += 1;
- $col -= 1;
- while ($arr[$row][$col] == '|' && $row < $size) {
- $arr[$row++][$col] = $str[$index++ % strlen($str)];
- }
- $row -= 1;
- $col -= 1;
- while ($arr[$row][$col] == '|' && $col >= 0) {
- $arr[$row][$col--] = $str[$index++ % strlen($str)];
- }
- $row -= 1;
- $col += 1;
- while ($arr[$row][$col] == '|' && $col >= 0) {
- $arr[$row--][$col] = $str[$index++ % strlen($str)];
- }
- $row += 1;
- $col += 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement