Common interception of strings in PHP

Source: Internet
Author: User
Because of the recent development requirements, after the password is MD5 encrypted, it involves the string interception of ciphertext. So I wrote this blog, I hope you support.

The constructed string
$str = "AJAFAFPAFFAFDFDFD";
echo "original string". $str. "";
$str 1 = substr ($STR, 5);
echo "starts at the end of the fifth character." $str 1. "";
$str 2 = substr ($str, 0,4);
echo "takes 4 characters starting from the No. 0 character:". $str 2. "";
$str 3 = substr ($str,-5);
echo "Take the last 5 characters:". $str 3. "";
$str 4 = substr ($str, -8,4);
echo "intercepts 4 characters starting from the 8th character:". $str 4. ";
$str 5 = substr ($str, -8,-2);
echo "intercepts 2 characters from the last 8th character:". $str 5. "";
?>

The above describes the PHP string commonly used interception operations, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.