How to remove the first digits of a string in php

藏色散人
Release: 2023-03-08 10:42:01
Original
3448 people have browsed it

php method to remove the first digits of a string: first create a PHP sample file; then define a string; finally delete the first 4 characters of the string through the "substr($str, 4);" statement That’s it.

How to remove the first digits of a string in php

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

Use PHP to delete the first 4 characters of a string?

You can use the substr function to return a substring starting from the 5th character:

$str = "The quick brown fox jumps over the lazy dog."
$str2 = substr($str, 4); // "quick brown fox jumps over the lazy dog."
Copy after login

[Recommended learning: "PHP Video Tutorial 》】

The above is the detailed content of How to remove the first digits of a string in php. 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