Learn PHP note string handling
- 2020-03-31 21:09:02
- OfStack
The substr ();
Substr (STR, start and length);
Example: substr(' PHP is very good language',4,5);
The output is is ve;
When start> The length of STR is returned as ();
Substr (' PHP is very good language',26,5);
Substr (' PHP is very good language',4);
Output as (blank)
The output is is v (indicating that both start and langth are 4)
When start is negative, start reading from the end of STR (* starts reading from -1 instead of 0),
Substr (' PHP is very good language',-4,5);
The output is uage
When length is negative, length represents reading from the end, intercepting the end of STR.
Substr (' PHP is very good language',4,-5);
The output is very good LAN
Limit () splits the function string into an array;
Strrev () takes the function string
Setlocalhost (content location) setlocalhost(content location) setlocalhost(content location) setlocalhost(content location)
LC_ALL, all subordinate constants
LC_COLLATE sorted order
LC_CTYPE font classification and conversion (e.g., convert all characters to lowercase or uppercase)
LC_MESSAGES system message format
LC_MONETARY: currency/currency format
LC_NUMERIC numeric format
LC_TIME, date and time format
); Location, set the country region, for example, CHS.
Strftime () formats the local time/date according to locale Settings.
Substr (STR, start and length);
Example: substr(' PHP is very good language',4,5);
The output is is ve;
When start> The length of STR is returned as ();
Substr (' PHP is very good language',26,5);
Substr (' PHP is very good language',4);
Output as (blank)
The output is is v (indicating that both start and langth are 4)
When start is negative, start reading from the end of STR (* starts reading from -1 instead of 0),
Substr (' PHP is very good language',-4,5);
The output is uage
When length is negative, length represents reading from the end, intercepting the end of STR.
Substr (' PHP is very good language',4,-5);
The output is very good LAN
Limit () splits the function string into an array;
Strrev () takes the function string
Setlocalhost (content location) setlocalhost(content location) setlocalhost(content location) setlocalhost(content location)
LC_ALL, all subordinate constants
LC_COLLATE sorted order
LC_CTYPE font classification and conversion (e.g., convert all characters to lowercase or uppercase)
LC_MESSAGES system message format
LC_MONETARY: currency/currency format
LC_NUMERIC numeric format
LC_TIME, date and time format
); Location, set the country region, for example, CHS.
Strftime () formats the local time/date according to locale Settings.