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

小云云
Release: 2023-03-22 11:28:01
Original
37863 people have browsed it

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

Output result: 6789

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

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!