The LTrim () function of the PHP string is used

Source: Internet
Author: User

LTrim
  • (PHP 4, PHP 5, PHP 7)
  • Ltrim-strip whitespace (or other characters) from the beginning of a string
  • ltrim-Delete whitespace characters (or other characters) at the beginning of a string
Description
string ltrim ( string $str [, string $character_mask ] )//Strip whitespace (or other characters) from the beginning of a string.//删除字符串开头的空白字符(或其他字符)
Parametersstr
    • The input string.
    • The input string.
Character_mask
    • You can also specify the characters your want to strip, by means of the Character_mask parameter. Simply list all characters so want to be stripped. With.. You can specify a range of characters.
    • With the parameter character_mask, you can also specify the characters you want to delete and simply list all the characters you want to delete. Use: To specify the range of characters.
Return Values
    • This function returns a string with whitespace stripped from the beginning of Str. Without the second parameter, LTrim () would strip these characters:
    • The function returns a string that removes the leftmost white space character of Str. If you do not use the second argument, LTrim () deletes only the following characters:
  • "" (ASCII (0x20)), an ordinary space. Plain white space character.
  • "\ T" (ASCII 9 (0x09)), a tab. tab.
  • "\ n" (ASCII (0x0A)), a new line feed. NewLine characters.
  • "\ R" (ASCII (0x0D)), a carriage return. Carriage return.
  • "\" (ASCII 0 (0x00)), the Nul-byte.nul null byte character.
  • "\x0b" (ASCII One (0x0B)), a vertical tab. Vertical tab.
Examples
<?php/*** Created by Phpstorm.* User:zhangrongxiang* DATE:2018/3/4* Time: PM 4:37 *///ltrim-Delete whitespace characters (or other characters) at the beginning of a string$hello="Hello World";//hello WorldEcho LTrim( $hello ).Php_eol;//ello WorldEcho LTrim( $hello, ' H ' ).Php_eol;//llo WorldEcho LTrim( $hello, ' EH ' ).Php_eol;$text="\t\tThese is a few words:) ... ";//These is a few words:) ...Echo $text.Php_eol;//these is a few words:) ...Echo LTrim( $text ).Php_eol;//these is a few words:) ...Echo LTrim( $text, "\ t" ).Php_eol;//These is a few words:) ...Echo LTrim( $text, ' \ t ' ).Php_eol;$binary="\x09Example String\x0a";//Example string//Echo $binary.Php_eol;//example String//Echo LTrim( $binary ).Php_eol;//example String//Echo LTrim( $binary, "\x00..\x1f" ).Php_eol;
See
    • http://php.net/manual/zh/function.ltrim.php

      All rights reserved

The LTrim () function of the PHP string is used

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.