Home>Article>Backend Development> How to remove the first two characters of a string in php
php method to remove the first two characters of a string: 1. Use the substr() function, the syntax "substr($str, 2)"; 2. Use the substr_replace() function, the syntax "substr_replace($str , '', 0,2)”.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
php removes strings The first two characters
1. Use the substr() function
The substr() function can intercept a certain length of characters from the specified position of the string. Character, returns the extracted part of the string, returns FALSE on failure, or returns an empty string.
2. Use the substr_replace() function
substr_replace() function to replace part of a string with another string .
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to remove the first two characters of a string in php. For more information, please follow other related articles on the PHP Chinese website!