For more information about the ltrim () function, php experts, why can't I get the desired result about the ltrim () function? Let's take a look at the code. $ str1E: xmapphtdocsmycodemycodecms; $ str2E: xmapphtdocs; echo & nbsp; ltrim ($ str1, $ str2 ). & lt; br & gt; about the ltrim () function
Dear php experts, why can't I get the desired result about the ltrim () function? Let's take a look at the code.
$str1="E:/xmapp/htdocs/mycode/mycode/cms/";
$str2="E:/xmapp/htdocs/";
echo ltrim($str1,$str2)."
";
The output result of running code is:
Ycode/mycode/cms/
Expected code output result;
Mycode/cms/
The second code:
$str3="e:/hell/ab/mycode/cms";
$str4="e:/hell/ab/";
echo ltrim($str3,$str4)."
";
The output result of running code is:
Mycode/cms
Expected code output result;
Mycode/cms
Ladies and gentlemen: Why is the expectation of the first code different from that of the actual output code, while the expectation of the second code is the same as that of the actual code (note: the two codes run independently without additional code)
------ Solution --------------------
I really don't know how your Chinese teacher taught you?
The charlist parameter specifies which characters are deleted from the string.
Note:
Character, No
String
If you do not understand Chinese, you should also understand English.
Strip whitespace (or other characters) from the beginning of a string
Strip stripping
Whitespace (or other characters) blank (or other characters)
From the beginning of a string starts with a string
Charlist character list
You also need to learn how to understand the function usage from the function prototype.
For ltrim ($ str1, $ str2)
Scan $ str1 and delete the characters that appear in $ str2 one by one until they appear outside $ str2.