Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Get part of string
<?php mb_substr( string $string, int $start, ?int $length = null, ?string $encoding = null): string
<?php return false;
}
return mb_substr($subject, $index, 1);
}
<?php $start = ltrim($matches[1]);
$start = str(mb_substr($start, max(mb_strlen($start, 'UTF-8') - $radius, 0), $radius, 'UTF-8'))->ltrim()->unless(
fn ($startWithRadius) => $startWithRadius->exactly($start),
fn ($startWithRadius) => $startWithRadius->prepend($omission),
);
<?php $end = rtrim($matches[3]);
$end = str(mb_substr($end, 0, $radius, 'UTF-8'))->rtrim()->unless(
fn ($endWithRadius) => $endWithRadius->exactly($end),
fn ($endWithRadius) => $endWithRadius->append($omission),
);
<?php return $string;
}
$segment = mb_substr($string, $index, $length, $encoding);
if ($segment === '') {
return $string;
<?php $startIndex = $index < -$strlen ? 0 : $strlen + $index;
}
$start = mb_substr($string, 0, $startIndex, $encoding);
$segmentLen = mb_strlen($segment, $encoding);
$end = mb_substr($string, $startIndex + $segmentLen);
<?php $start = mb_substr($string, 0, $startIndex, $encoding);
$segmentLen = mb_strlen($segment, $encoding);
$end = mb_substr($string, $startIndex + $segmentLen);
return $start.str_repeat(mb_substr($character, 0, 1, $encoding), $segmentLen).$end;
}
<?php $segmentLen = mb_strlen($segment, $encoding);
$end = mb_substr($string, $startIndex + $segmentLen);
return $start.str_repeat(mb_substr($character, 0, 1, $encoding), $segmentLen).$end;
}
<?php $shortLeft = floor($short / 2);
$shortRight = ceil($short / 2);
return mb_substr(str_repeat($pad, $shortLeft), 0, $shortLeft).
$value.
mb_substr(str_repeat($pad, $shortRight), 0, $shortRight);
}
<?php return mb_substr(str_repeat($pad, $shortLeft), 0, $shortLeft).
$value.
mb_substr(str_repeat($pad, $shortRight), 0, $shortRight);
}
<?php $short = max(0, $length - mb_strlen($value));
return mb_substr(str_repeat($pad, $short), 0, $short).$value;
}
<?php $short = max(0, $length - mb_strlen($value));
return $value.mb_substr(str_repeat($pad, $short), 0, $short);
}
<?php } else {
if (in_array($lowercaseWord, $minorWords) &&
mb_strlen($lowercaseWord) <= 3 &&
! ($i === 0 || in_array(mb_substr($words[$i - 1], -1), $endPunctuation))) {
$words[$i] = $lowercaseWord;
} else {
$words[$i] = ucfirst($lowercaseWord);
<?php public static function substr($string, $start, $length = null, $encoding = 'UTF-8')
{
return mb_substr($string, $start, $length, $encoding);
}
<?php } elseif ($extraValue === 'NOT_NULL') {
$query->whereNotNull($key);
} elseif (str_starts_with($extraValue, '!')) {
$query->where($key, '!=', mb_substr($extraValue, 1));
} else {
$query->where($key, $extraValue);
}
<?php protected function insertLineNumberAtPosition(int $position, string $value)
{
$before = mb_substr($value, 0, $position);
$lineNumber = count(explode("\n", $before));
return mb_substr($value, 0, $position)."|---LINE:{$lineNumber}---|".mb_substr($value, $position);