strpos

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find the position of the first occurrence of a substring in a string
strpos(string $haystackstring $needleint $offset 0): int|false
    public function containsDots($subject)

    {

        return 
strpos($subject'.') !== false;

    }



    public function 
beforeFirstDot($subject)
        $queryParams $this->mergeComponentPropertiesWithExistingQueryParamsFromOtherComponentsAndTheRequest($component);



        if (
$route && ! $route->getActionName() instanceof \Closure && false !== strpos($route->getActionName(), get_class($component))) {

            
$path $response->effects['path'] = $this->buildPathFromRoute($component$route$queryParams);

        } else {

            
$path $this->buildPathFromReferer($referer$queryParams);
    protected function extractQueryString($path)

    {

        if ((
$queryPosition strpos($path'?')) !== false) {

            return [

                
substr($path0$queryPosition),

                
substr($path$queryPosition),
            return $subject;

        }



        
$position strpos($subject$search);



        if (
$position !== false) {

            return 
substr_replace($subject$replace$positionstrlen($search));
    public function hasHintInformation($name)

    {

        return 
strpos($name, static::HINT_PATH_DELIMITER) > 0;

    }
    private function classNameFromFileName(string $suiteClassFile): string

    
{

        
$className basename($suiteClassFile'.php');

        
$dotPos    strpos($className'.');



        if (
$dotPos !== false) {

            
$className substr($className0$dotPos);
            case '0A000':



                if (
strpos($exception->getMessage(), 'truncate') !== false) {

                    return new 
ForeignKeyConstraintViolationException($exception$query);

                }
        if ($exception->getCode() === && strpos($exception->getMessage(), 'SQLSTATE[08006]') !== false) {

            return new 
ConnectionException($exception$query);

        }
    public function convert(Exception $exception, ?Query $query): DriverException

    
{

        if (
strpos($exception->getMessage(), 'database is locked') !== false) {

            return new 
LockWaitTimeoutException($exception$query);

        }
        }



        if (

            
strpos($exception->getMessage(), 'must be unique') !== false ||

            
strpos($exception->getMessage(), 'is not unique') !== false ||

            
strpos($exception->getMessage(), 'are not unique') !== false ||

            
strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false
        if (

            
strpos($exception->getMessage(), 'must be unique') !== false ||

            
strpos($exception->getMessage(), 'is not unique') !== false ||

            
strpos($exception->getMessage(), 'are not unique') !== false ||

            
strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false

        
) {
        if (

            
strpos($exception->getMessage(), 'must be unique') !== false ||

            
strpos($exception->getMessage(), 'is not unique') !== false ||

            
strpos($exception->getMessage(), 'are not unique') !== false ||

            
strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false

        
) {

            return new 
UniqueConstraintViolationException($exception$query);
            strpos($exception->getMessage(), 'must be unique') !== false ||

            
strpos($exception->getMessage(), 'is not unique') !== false ||

            
strpos($exception->getMessage(), 'are not unique') !== false ||

            
strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false

        
) {

            return new 
UniqueConstraintViolationException($exception$query);

        }
        }



        if (

            
strpos($exception->getMessage(), 'may not be NULL') !== false ||

            
strpos($exception->getMessage(), 'NOT NULL constraint failed') !== false

        
) {

            return new 
NotNullConstraintViolationException($exception$query);
        if (

            
strpos($exception->getMessage(), 'may not be NULL') !== false ||

            
strpos($exception->getMessage(), 'NOT NULL constraint failed') !== false

        
) {

            return new 
NotNullConstraintViolationException($exception$query);

        }