-
-
- $test = end(explode('.', 'abc.txt'));
- echo $test;//output txt
Copy the code
and replace it with:
-
-
- $test1 = end(split('.','abc.txt'));
- echo $test1;//no output
Copy the code
use split The correct approach is: add escape symbols
-
-
- $test1 = end(split('.','abc.txt'));
- echo $test1;//output txt
Copy code
Remarks : The "." symbol is a keyword in regular expressions, so split is invalid, but explode is valid.
|