Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return part of a string
<?php substr(string $string, int $offset, ?int $length = null): string
<?php $key = $this->app['config']['app.key'];
if (Str::startsWith($key, 'base64:')) {
$key = base64_decode(substr($key, 7));
}
return new TokenRepository(
<?php $output = $this->runComposerCommand(...array_merge($parts, ['--format=json']));
$json = substr($output, strpos($output, "\n{"));
return json_decode($json);
}
<?php $ext = pathinfo($path, PATHINFO_EXTENSION);
$pathWithoutExtension = substr($path, 0, -(strlen($ext) + 1));
$path = substr($pathWithoutExtension, 0, -(strlen($suffix) + 1));
<?php $pathWithoutExtension = substr($path, 0, -(strlen($ext) + 1));
$path = substr($pathWithoutExtension, 0, -(strlen($suffix) + 1));
return $path.'.'.$ext;
}
<?php public function startsWith($haystack, $needle)
{
return substr($haystack, 0, strlen($needle)) === $needle;
}
<?php public function endsWith($haystack, $needle)
{
return strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0;
}
<?php $order = 'asc';
if (Str::startsWith($sort, '-')) {
$sort = substr($sort, 1);
$order = 'desc';
}
<?php ])->merge($fields->values());
if ($collection->dated()) {
$values['date'] = substr(now()->toDateTimeString(), 0, 10);
}
$viewData = [
<?php }
if ($entry->collection()->dated()) {
$datetime = substr($entry->date()->toDateTimeString(), 0, 16);
$datetime = ($entry->hasTime()) ? $datetime : substr($datetime, 0, 10);
$values['date'] = $datetime;
}
<?php if ($entry->collection()->dated()) {
$datetime = substr($entry->date()->toDateTimeString(), 0, 16);
$datetime = ($entry->hasTime()) ? $datetime : substr($datetime, 0, 10);
$values['date'] = $datetime;
}
<?php ]);
if ($entry->collection()->dated()) {
$datetime = substr($entry->date()->toDateTimeString(), 0, 16);
$datetime = ($entry->hasTime()) ? $datetime : substr($datetime, 0, 10);
$values['date'] = $datetime;
}
<?php if ($entry->collection()->dated()) {
$datetime = substr($entry->date()->toDateTimeString(), 0, 16);
$datetime = ($entry->hasTime()) ? $datetime : substr($datetime, 0, 10);
$values['date'] = $datetime;
}
<?php $phpInfo = [];
foreach ($sections as $section) {
$heading = substr($section, 0, strpos($section, '</h2>'));
if (preg_match_all('#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#', $section, $matches, PREG_SET_ORDER) !== 0) {
<?php }
if (Str::contains($url, '?')) {
$url = substr($url, 0, strpos($url, '?'));
}
if (Str::endsWith($url, '/') && Str::length($url) > 1) {
<?php return $value;
}
return substr($value, 0, -$params[0]);
}