How to remove the first string in php

藏色散人
Release: 2023-03-02 06:48:01
Original
2054 people have browsed it

php method to remove the first string of a string; first create a PHP code sample file; then enter the code statement as "substr('string',1);"; finally execute it in the browser This file can successfully remove the first string in the specified string.

How to remove the first string in php

Delete the first character of the string

substr('string',1) ;

substr() function definition and usage

substr() function returns a part of a string.

Note: If the start parameter is negative and length is less than or equal to start, length is 0.

Syntax

substr(string,start,length)
Copy after login

Parameters

string Required. Specifies a part of the string to be returned.

start Required. Specifies where in the string to begin.

Positive number - starts at the specified position in the string

Negative number - starts at the specified position from the end of the string

0 - at the first character in the string Start at

length Optional. Specifies the length of the string to be returned. The default is until the end of the string.

Positive number - Returns from the position of the start parameter

Negative number - Returns from the end of the string

Return value: Returns the extracted part of the string, returns FALSE if it fails , or return an empty string.

Update log: In PHP 5.2.2 to 5.2.6 versions, if the start parameter represents a negative truncation or an out-of-bounds position, FALSE is returned. Other versions get the string starting at the start position.

For more related knowledge, please visitPHP Chinese website!

The above is the detailed content of How to remove the first string in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!