php method to intercept the last four digits of a string: first create a PHP sample file; then intercept the last four digits of the specified string through the "substr($str_bh,-4);" method; and finally output it through echo Just intercept the results.
Recommendation: "PHP Video Tutorial"
Example:
After PHP intercepts the string Four digits
$str_bh='123456789'; $abc=substr($str_bh,-4); echo $abc;
Output result: 6789
<?php echo substr("Hello world!",6,5); ?>
Result: world
The above is the detailed content of How to implement php to intercept the last few digits of a string. For more information, please follow other related articles on the PHP Chinese website!