In PHP, you can use the substr() function to split a string to remove the first character. This function can return a part of the string. When the parameter is set to "1", the first character can be removed. , the syntax is "substr("string",1);".
The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer.
In PHP, you can use the substr interception string function to delete the first character of the string.
Create a new php file named test.php to explain how php deletes the first character of a string. Use the header() method to set the encoding format of the page to utf-8.
In the test.php file, define a string variable for testing. Through the substr function, intercept from the second character of the string to the end to delete the first character. Use echo to output the processed string.
Open the test.php file in the browser to view the results.
Summary:
1. Define a string variable for testing.
2. Use the substr function to intercept from the second character of the string to the end to delete the first character.
3. Use echo to output the processed string.
4. Open the test.php file in the browser and view the results.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to remove the first character when splitting a string in php. For more information, please follow other related articles on the PHP Chinese website!