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

墨辰丷
Release: 2023-03-25 19:32:01
Original
3797 people have browsed it

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
Copy after login
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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template