Home >Backend Development >PHP Tutorial >How to intercept the last four digits of a string in PHP
This article mainly introduces how to intercept the last four digits of a string. Interested friends can refer to it. I hope it can help everyone.
$str_bh='123456789';$abc=substr($str_bh,-4); echo $abc; //输出结果:6789
Recommended related articles:
1.How to intercept the last few digits of a string in php
2.How to get the last n characters of a PHP string
Related video recommendations:
1.Dugu Jiujian (4)_PHP video tutorial
<?php echo substr("Hello world!",6,5); ?> //结果:world
Related recommendations:
PHP string definition methods and their differences
How to convert PHP strings into arrays
Detailed explanation of PHP string encoding issues
The above is the detailed content of How to intercept the last four digits of a string in PHP. For more information, please follow other related articles on the PHP Chinese website!