Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get string length
<?php strlen(string $string): int
<?php                 $strippedColumn = $this->stripAnsi($column);



                if (strlen($strippedColumn) > $columnWidths[$columnCount]) {

                    $columnWidths[$columnCount] = strlen($strippedColumn);

                }

            }
<?php                 $strippedColumn = $this->stripAnsi($column);



                if (strlen($strippedColumn) > $columnWidths[$columnCount]) {

                    $columnWidths[$columnCount] = strlen($strippedColumn);

                }

            }

        }
<?php     private function padColumn(string $text, int $width)

    {

        $ansiCharacterPadding = strlen($text) - strlen($this->stripAnsi($text));

        return str_pad($text, $width + $ansiCharacterPadding);

    }
<?php         $width = $this->getFullWidth($columnWidths);

        $halfWidth = intdiv($width, 2);

        $halfTextWidth = intdiv(strlen($strippedText), 2);



        return str_repeat(' ', $halfWidth - $halfTextWidth) . $text . str_repeat(' ', $halfWidth - $halfTextWidth) . "\n";

    }