Explanation of PHP function explode () usage _ PHP Tutorial

Source: Internet
Author: User
Explain how to use the PHP function explode. Currently, the PHP function explode () separates strings into arrays. explode (separator, string, limit) separator is required. Specifies where to split the string. String is required. The string to be split. L currentlyPHP function explode () splits string into arrays
Explode (separator, string, limit)
Separator is required. Specifies where to split the string.
String is required. The string to be split.
Limit is optional. Specifies the maximum number of returned array elements.

Example of PHP function explode ()

 
 
  1. $str = "Hello world. It's a beautiful day.";
  2. print_r (explode(" ",$str));
  3. ?>

Output:

 
 
  1. Array
  2. (
  3. [0] => Hello
  4. [1] => world.
  5. [2] => It's
  6. [3] => a
  7. [4] => beautiful
  8. [5] => day.
  9. )

The above code example is the specific use of the PHP function explode.


The export PHP function explode () splits the string into an array explode (separator, string, limit) separator. Specifies where to split the string. String is required. The string to be split. L...

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.