strpos

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find the position of the first occurrence of a substring in a string
<?php strpos(string $haystack, string $needle, int $offset = 0): int|false
<?php     {

        $prefix = $connection->getTablePrefix();



        return strpos($table, $prefix) === 0

            ? substr($table, strlen($prefix))

            : $table;

    }
<?php     protected function extractQueryString($path)

    {

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

            return [

                substr($path, 0, $queryPosition),

                substr($path, $queryPosition),
<?php             return $subject;

        }



        $position = strpos($subject, $search);



        if ($position !== false) {

            return substr_replace($subject, $replace, $position, strlen($search));
<?php             return $subject;

        }



        $position = strpos($subject, $search, $offset);



        if ($position !== false) {

            return [
<?php     public function hasHintInformation($name)

    {

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

    }
<?php     {

        $mySqlVersion = DB::select('select version()')[0]->{'version()'} ?? '';



        if (strpos($mySqlVersion, 'Maria') !== false) {

            $this->markTestSkipped('Lateral joins are not supported on MariaDB'.__CLASS__);

        } elseif ((float) $mySqlVersion < '8.0.14') {

            $this->markTestSkipped('Lateral joins are not supported on MySQL < 8.0.14'.__CLASS__);
<?php                     $arg['Destinations'] === ['me@example.com', 'you@example.com'] &&

                    $arg['ListManagementOptions'] === ['ContactListName' => 'TestList', 'TopicName' => 'TestTopic'] &&

                    $arg['Tags'] === [['Name' => 'FooTag', 'Value' => 'TagValue']] &&

                    strpos($arg['RawMessage']['Data'], 'Reply-To: Taylor Otwell <taylor@example.com>') !== false;

            }))

            ->andReturn($sesResult);
<?php                     $arg['Destination']['ToAddresses'] === ['me@example.com', 'you@example.com'] &&

                    $arg['ListManagementOptions'] === ['ContactListName' => 'TestList', 'TopicName' => 'TestTopic'] &&

                    $arg['Tags'] === [['Name' => 'FooTag', 'Value' => 'TagValue']] &&

                    strpos($arg['Content']['Raw']['Data'], 'Reply-To: Taylor Otwell <taylor@example.com>') !== false;

            }))

            ->andReturn($sesResult);
<?php     private function classNameFromFileName(string $suiteClassFile): string

    {

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

        $dotPos = strpos($className, '.');



        if ($dotPos !== false) {

            $className = substr($className, 0, $dotPos);
<?php         $basename = basename($relativePath, '.php');



        $dotPos = strpos($basename, '.');



        if ($dotPos !== false) {

            $basename = substr($basename, 0, $dotPos);
<?php             case '0A000':



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

                    return new ForeignKeyConstraintViolationException($exception, $query);

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

            return new ConnectionException($exception, $query);

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

    {

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

            return new LockWaitTimeoutException($exception, $query);

        }
<?php         }



        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
<?php         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

        ) {