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         }




        $error = \substr($error, 0, (\strlen($error) - 5));



        if ($errorInfo['alternative'] !== '') {

            $error .= $this->getAlternativeOptionTemplate();
<?php             return '';

        }



        $regexFirstChar = \substr($regex, 0, 1);
<?php             return '';

        }



        return \substr($regex, $regexEndPos + 1);

    }

}
<?php         if (\strpos($name, 'namespace\\') === 0) {

            $name = \substr($name, 10);

        }



        $namespace = Namespaces::determineNamespace($phpcsFile, $stackPtr);
<?php             throw new RuntimeException('$FQName must be a fully qualified name');

        }



        return (\strpos(\substr($FQName, 1), '\\') !== false);

    }
<?php         $contents = $tokens[$stackPtr]['content'];



        if (\substr($contents, 0, 2) !== '#[') {


            return;

        }
<?php         $expectedErrors = \substr_count($contents, '#[');

        $actualErrors   = 0;



        while (empty($contents) === false && \substr($contents, 0, 2) === '#[') {

            $length         = \strlen($contents);

            $nestedBrackets = 1;
<?php                     if ($nestedBrackets === 0) {


                        $this->throwError($phpcsFile, $stackPtr, \substr($contents, 0, ($i + 1)));

                        ++$actualErrors;



                        if (($i + 1) === $length) {
<?php                         if (($i + 1) === $length) {

                            $contents = '';

                        } else {

                            $contents = \trim(\substr($contents, ($i + 1)));

                        }

                        break;

                    }
<?php             return;

        }



        $className   = \substr($FQClassName, 1); // Remove global namespace indicator.

        $classNameLc = \strtolower($className);



        if (isset($this->newClasses[$classNameLc]) === false) {
<?php             return;

        }



        $className   = \substr($FQClassName, 1); // Remove global namespace indicator.

        $classNameLc = \strtolower($className);



        if (isset($this->removedClasses[$classNameLc]) === false) {
<?php         foreach ($parameters as $param) {

            if (Variables::isSuperglobalName($param['name']) === true) {

                $error     = 'Parameter shadowing super global (%s) causes a fatal error since PHP 5.4';

                $errorCode = $this->stringToErrorCode(\substr($param['name'], 1)) . 'Found';

                $data      = [$param['name']];



                $phpcsFile->addError($error, $param['token'], $errorCode, $data);
<?php         }




        $error      = \substr($error, 0, (\strlen($error) - 5));

        $errorCode .= $codeSuffix . 'Required';



        $this->addMessage($phpcsFile, $error, $stackPtr, $versionInfo['error'], $errorCode, $data);
<?php             }

        }



        $snippet = \substr($content, $startPos, $length);

        if ((\strlen($content) - $startPos) > $length) {

            $snippet .= '...';

        }
<?php                 $afterMarker = \substr($trimmed, \strlen($identifier));


                $afterMarker = \ltrim($afterMarker, ';');