1:explode Split string
eg
$str = XXX:ABC;
$ABC = Explode (': ', ' $str '); Obtained is an array of
echo $ABC [1]; Output ABC
Cons: Must know the split point, and the location of the required data
Advantages: Good understanding
2:str_replace replacing string Parts
eg
$str = ABCDEFG;
$ABC = Str_replace (' DEFG ', ' ', ' $str '); Replace the DEFG with empty
Echo $abc; Output ABC
Disadvantage: The replaced part must be known
Advantages: Good understanding
3:SUBSTR Calendar String
eg
$str = ABCDEFG;
$re = Array ();
for ($i = 0; $i < strlen ($STR); $i + +) {//convert $str to an array
$re [] = substr ($str, $i, 1);
}
echo $re [0]. $re [1]. $re [2]; Output ABC
Cons: Must know the entire string, inefficient
Advantages: Random Splicing
The above introduces the JS intercept string interception string commonly used methods, including the JS intercept string aspects of the content, I hope the PHP tutorial interested in a friend helpful.