Home >Backend Development >PHP Tutorial >How to intercept the last four digits of a string in PHP

How to intercept the last four digits of a string in PHP

墨辰丷
墨辰丷Original
2018-05-15 17:36:243828browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP Get permissionsNext article:PHP Get permissions