function Helper::length
Returns the length of a string, using mb_strlen if it is available. The length is related to how many bytes the string will use.
2 calls to Helper::length()
- ProgressBar::initPlaceholderFormatters in vendor/
symfony/ console/ Helper/ ProgressBar.php - Table::renderCell in vendor/
symfony/ console/ Helper/ Table.php - Renders table cell with padding.
File
-
vendor/
symfony/ console/ Helper/ Helper.php, line 59
Class
- Helper
- Helper is the base class for all helper classes.
Namespace
Symfony\Component\Console\HelperCode
public static function length(?string $string) : int {
$string ??= '';
if (preg_match('//u', $string)) {
return (new UnicodeString($string))->length();
}
if (false === ($encoding = mb_detect_encoding($string, null, true))) {
return \strlen($string);
}
return mb_strlen($string, $encoding);
}