There is a string of n characters. For example, the line: "I am a noob in php" it is necessary to divide it into characters and write them in a separate cell. and set the number of columns. For example, 4. And there should be as many lines as needed in order to fit all the text so that it visually looks like this: 
if there are 11 or more columns, then everything will be in one row.
it is clear to the characters how to break, but how to indicate how much I need to make columns in this array I just do not understand. Poke your nose at least or point at a clever idea.
UPD: if you fill in with your hands, it will come out like this, but how to do it, what would be the most lined up for a given number?
<?php echo "<pre>"; $text = 'очень большой текст'; $text = preg_split('//u',$text,-1,PREG_SPLIT_NO_EMPTY); $key = "привет"; $count = mb_strlen($key); echo "Должно быть: ".$count. ' столбцов.'; $a = array('о','ь','л','й','к',' '); $b = array('ч',' ','ь',' ','с',' '); $c = array('е','б','ш','т','т',' '); $d = array('н','о','о','е',' ',' '); $THN = array($a, $b, $c, $d); for($i=0; $i < count($THN); $i++) { for($q=0; $q < count($THN[$i]); $q++) { echo "|".$THN[$i][$q]; } echo "<br>"; } ?> UPD 2: I dig towards multidimensional arrays, but again with handles. fill in then i fill in the loop, but how to indicate that i should have exactly! 4! array, even if I obviously indicate this in the code. How exactly to create a new array in a loop? Is it indicated number 4 or 100?
#сюда как бы нужно заполнить массив $text, но не ручками $myArray = array( array('о','ь','л','й','к',' '), array('ч',' ','ь',' ','с',' '), array('е','б','ш','т','т',' '), array('н','о','о','е',' ',' ') ); for ($i = 0; $i < 4; $i++){ for ($j=0; $j <6; $j++){ echo ' | '.$myArray[$i][$j]; } echo '<br />'; } Thank you in advance!