PHP breaks characters into multiple string methods, PHP characters multiple strings _php tutorial

Source: Internet
Author: User
Tags php programming string methods

Php method of breaking characters into multiple strings, PHP character multiple strings


The example in this article describes how PHP breaks down characters into multiple substrings. Share to everyone for your reference. The implementation method is as follows:

The decomposition string is primarily implemented by the split () function, which is used to break a string into multiple substrings by a specified character and into the array separately. Its syntax is declared as follows:
Array Split (string pattern,string str[,int limit]);
The parameters are:
Pattern: Used to specify the symbol to be identified as a decomposition, note that the parameter is case sensitive.
STR: The string to be processed.
Limit: Returns the maximum value of the number of decomposed substrings, returned by default.

Examples are as follows:

Use the split () function to break down the string "2006-10-12 16:50:49" into a month-and-day time and minute substring, with the following program code:
Copy the Code code as follows: <?php
$date = "2006-10-12 16:50:49";
List ($year, $month, $day, $hour, $minute, $second) =split (' [-:] ', $date);
echo "Beijing time: {$year} year {$month} month {$day} day {$hour} {$minute} minutes {$second} seconds";
?>
The result of this example is: Beijing time: October 12, 2006 16:50 49 seconds

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/916062.html www.bkjia.com true http://www.bkjia.com/PHPjc/916062.html techarticle PHP breaks characters into multiple strings, PHP characters multiple Strings This example describes how PHP decomposes characters into multiple substrings. Share to everyone for your reference. Concrete implementation ...

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