How to remove the symbol on the left side of a character in php

WBOY
Release: 2023-03-15 10:36:02
Original
3345 people have browsed it

In PHP, you can use the ltrim() function to remove the symbol on the left side of the character. The function of this function is to remove the blank characters or other predefined characters on the left side of the string. You only need to set the parameter to the one specified on the left. The symbol is enough, and the syntax is "ltrim (the string of characters that need to be removed, the symbol on the left that needs to be removed)".

How to remove the symbol on the left side of a character in php

The operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer

How to remove the symbol on the left side of the character in php

ltrim() function removes whitespace characters or other predefined characters on the left side of a string.

Related functions:

  • rtrim() - Removes whitespace characters or other predefined characters on the right side of a string.

  • trim() - Removes whitespace or other predefined characters from both sides of a string.

The syntax is:

ltrim(string,charlist)
Copy after login

The example is as follows:

<?php
$str = "Hello World!";
echo $str . "<br>";
echo ltrim($str,"Hello");
?>
Copy after login

Output result:

How to remove the symbol on the left side of a character in php

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to remove the symbol on the left side of a character 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