substr

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_starts_with($key, 'base64:')) {

            $key = base64_decode(substr($key, 7));

        }



        $connection = $config['connection'] ?? null;
<?php                 return $this->emptyPayload();

            }



            $expire = substr($contents, 0, 10);

        } catch (Exception) {

            return $this->emptyPayload();

        }
<?php         }



        try {

            $data = unserialize(substr($contents, 10));

        } catch (Exception) {

            $this->forget($key);
<?php     public static function remove($cookieValue)

    {

        return substr($cookieValue, 41);

    }
<?php         if (! is_null($columns)) {

            foreach ($columns as $column) {

                if (($position = strripos($column, ' as ')) !== false) {

                    $original = substr($column, 0, $position);



                    $alias = substr($column, $position + 4);
<?php                 if (($position = strripos($column, ' as ')) !== false) {

                    $original = substr($column, 0, $position);



                    $alias = substr($column, $position + 4);



                    if ($parameter === $alias || $builder->getGrammar()->wrap($parameter) === $alias) {

                        return $original;
<?php         $prefix = $connection->getTablePrefix();



        return str_starts_with($table, $prefix)

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

            : $table;

    }

}
<?php     protected function guessModelName($name)

    {

        if (str_ends_with($name, 'Factory')) {

            $name = substr($name, 0, -7);

        }



        $modelName = $this->qualifyModel(Str::after($name, $this->rootNamespace()));
<?php         foreach ($this->eagerLoad as $name => $constraints) {

            if ($this->isNestedUnder($relation, $name)) {

                $nested[substr($name, strlen($relation.'.'))] = $constraints;

            }

        }
<?php             if (str_starts_with($key, 'pivot_')) {

                $values[substr($key, 6)] = $value;



                unset($model->$key);

            }
<?php     public function dynamicWhere($method, $parameters)

    {

        $finder = substr($method, 5);



        $segments = preg_split(

            '/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE
<?php     {

        return array_map(function ($column) {

            return is_string($column) && ($aliasPosition = stripos($column, ' as ')) !== false

                    ? substr($column, 0, $aliasPosition) : $column;

        }, $columns);

    }
<?php         $offset = $where['query'] instanceof JoinClause ? 3 : 6;



        return '('.substr($this->compileWheres($where['query']), $offset).')';

    }
<?php     protected function compileNestedHavings($having)

    {

        return '('.substr($this->compileHavings($having['query']), 7).')';

    }
<?php             return chmod($path, $mode);

        }



        return substr(sprintf('%o', fileperms($path)), -4);

    }