Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get string length
<?php strlen(string $string): int
<?php     protected function resolveContainerFromUrl($url)

    {

        return AssetContainer::all()->sortByDesc(function ($container) {

            return strlen($container->url());

        })->first(function ($container, $id) use ($url) {

            return starts_with($url, $container->url())

                || starts_with(URL::makeAbsolute($url), $container->url());
<?php                     return $date;

                }



                if (strlen($date) === 10) {

                    return Carbon::createFromFormat('Y-m-d', $date)->startOfDay();

                }
<?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     {

        return $this->config(

            'format',

            strlen($date) > 10 ? self::DEFAULT_DATETIME_FORMAT : self::DEFAULT_DATE_FORMAT

        );

    }
<?php             return Statamic::cpDateFormat();

        }



        return $this->config('format') || strlen($this->field->value()) > 10

            ? Statamic::cpDateTimeFormat()

            : Statamic::cpDateFormat();

    }
<?php         if (! $this->config('format') && strlen($value) === 10) {

            $date->startOfDay();

        }
<?php     protected function formatDateForSaving($date)

    {


        if (strlen($date) > 10) {

            $date = str_replace(':', '', $date);

            $date = str_replace(' ', '-', $date);

        }
<?php             is_string($value) &&

            preg_match('/\b('.implode('|', $sensitiveKeywords).')\b/', $this->camelToWords($name, false))

        ) {

            $value = str_repeat('•', strlen($value));

        }



        return $value;
<?php     private function testValidQuery($query)

    {

        $length = strlen($query);



        if ($length === 0) {

            throw new NoQuery('No query given.');
<?php             foreach ($words as $word) {


                if (strpos($word, '-') === 0 && strlen($word) >= $this->min_word_characters + 1) {

                    array_push($parts['disallowed'], substr($word, 1));

                } elseif (strpos($word, '+') === 0 && strlen($word) >= $this->min_word_characters + 1) {

                    array_push($parts['required'], substr($word, 1));
<?php                 if (strpos($word, '-') === 0 && strlen($word) >= $this->min_word_characters + 1) {

                    array_push($parts['disallowed'], substr($word, 1));

                } elseif (strpos($word, '+') === 0 && strlen($word) >= $this->min_word_characters + 1) {

                    array_push($parts['required'], substr($word, 1));

                } elseif (strlen($word) >= $this->min_word_characters) {

                    array_push($parts['chunks'], $word);
<?php                     array_push($parts['disallowed'], substr($word, 1));

                } elseif (strpos($word, '+') === 0 && strlen($word) >= $this->min_word_characters + 1) {

                    array_push($parts['required'], substr($word, 1));

                } elseif (strlen($word) >= $this->min_word_characters) {

                    array_push($parts['chunks'], $word);

                }

            }