Home >Backend Development >PHP Tutorial >How to intercept the last four digits of a string in PHP
Sometimes we will encounter the problem of displaying the following digits of a string. How to implement this function?
This article mainly shares with you how to intercept the last four digits of a string in PHP. I hope it can help you.
$str_bh='123456789';$abc=substr($str_bh,-4); echo $abc;
Output result: 6789
<?php echo substr("Hello world!",6,5); ?>
Result: world
Recommended related articles:
1.How to intercept strings in php The last few
2.How to get the last n characters of a PHP string
Related video recommendations:
1.Dugu Jiujian (4)_PHP video tutorial
Related recommendations:
A collection of common methods for intercepting strings in JS
How to implement the function of intercepting strings in js
Introduction to the method of intercepting strings in php
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!