PHP 4 string Format function for string manipulation

Source: Internet
Author: User
Tags string format

Strtolower ($STR)

Strtoupper ($STR)

Uppercase and lowercase conversions

Strtotime (' 2018-1-1 0:0 ')

String Turn timestamp

Date (' y-m-d h:i:s ', Time ())

Formatting timestamps

MD5 ()

Encryption

Trim ()

Removes white space characters (in particular) on either side of the string.

Strip_tags ()

Filter (delete) HTML tags (specifically reserved)

Htmlspecialchars ()

Convert special characters (labels) to HTML entities (not labels)

Htmlspecialchars_decode

Restores

<?PHP//uppercase and lowercase conversions$str= ' WWW.BAIDU.COM ';Echo $str=Strtolower($str), ' ;Echo $str=Strtoupper($str), ' ;//String Turn timestampDate_default_timezone_set (' PRC ');//Set the default time zoneEcho $chuo=Strtotime(' 2018-1-1 0:0 '), ' ;//Formatting timestampsEcho Date(' Y-m-d h:i:s ',$chuo), ' ;Echo Date(' Y-m-d h:i:s ', Time()), ' ;//Thousands separator function$num= 123456789.125;Echo Number_format($num, 2), ' ;//EncryptEcho MD5(MD5(123456)), ' ;Echo SHA1(123456), ' ;//trim () removes white space characters on either side of the string. $test= ' Kyoto all ';Echo Trim($test), ' ;//remove the ' all ' character on the rightEcho RTrim($test, ' all '), ' ;//Filter HTML Tags$html= ' <b>;//<b> Label Selection retentionEcho $html,‘---‘,Strip_tags($html, ' <b> '), ' ;//convert special characters to HTML entities$htm= ' <b>;Echo $htm=Htmlspecialchars($htm), ' ;//now reverse the processEcho $htm= Htmlspecialchars_decode ($htm);?>

PHP 4 string Format function for string manipulation

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.