Home > Backend Development > PHP Problem > How to implement php to intercept the last few digits of a string

How to implement php to intercept the last few digits of a string

藏色散人
Release: 2023-03-04 06:40:01
Original
6316 people have browsed it

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.

How to implement php to intercept the last few digits of a string

Recommendation: "PHP Video Tutorial"

Example:

After PHP intercepts the string Four digits

$str_bh='123456789';
$abc=substr($str_bh,-4);
echo $abc;
Copy after login

Output result: 6789

<?php
echo substr("Hello world!",6,5);
?>
Copy after login

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!

Related labels:
php
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