- implode: documentation ( source)
- array_fill: documentation ( source)
- str_pad: documentation ( source)
<?php
$size = 7;
$vertical = str_pad('*', $size * 2, ' ', STR_PAD_BOTH);
$result = array_fill(0, $size, $vertical);
$result[$size / 2] = implode(' ', array_fill(0, $size, '*'));
echo implode(PHP_EOL, $result);