Parsing PHP functions explode how to convert strings into arrays _php tutorial

Source: Internet
Author: User
We are learningThe format of the 1.PHP function explode is as follows:

Array explode (string separator, string string,[int limit]);

2. The separator in the parameter is a delimiter, string is the character to be split, and limit is the maximum number of elements in the returned array.

PHP function Explode specific use examples:

 
 
  1. php
  2. $ Document_root = $_server[' Document_root '];
  3. ?>
  4. <html>
  5. <head>
  6. < title > Test Explode title>
  7. head>
  8. <body>
  9. php
  10. $ Peoples = file ($DOCUMENT _root. ' /test/03/people.txt ');
  11. $ Count Count = count ($peoples);
  12. if ($count = = 0) {
  13. Echo ' NO peoples pending. Please try again later. ';
  14. }
  15. For ($i = 0; $i < $count; $i + +) { /c21>
  16. $ Line = Explode ("T", $peoples [$i]);
  17. Echo ' <font color=red>'. $line [0]. ' font> ';
  18. Echo ' <font color=blue>'. $line [1]. ' font> ';
  19. Echo ' <font color=green>'. $line [2]. ' font> ';
  20. Echo ' <BR />';
  21. }
  22. ?>
  23. body>
  24. html>

Hope that the vast number of learning enthusiasts through the PHP function explode introduced in this article, can basically understand the use of PHP function explode method.


http://www.bkjia.com/PHPjc/446337.html www.bkjia.com true http://www.bkjia.com/PHPjc/446337.html techarticle We are learning the format of the 1.PHP function explode as follows: Array explode (string separator, string string,[int limit]); 2. The separator in the parameter is the delimiter, string is the character to be split, ...

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