explode — Split a string by string

explode, split a string and return an array by using niddle in the string.

Example . explode()

  1. <html>  
  2.  <body>  
  3. <?php
  4. // Example 1
  5. $history= "php4 php5 php6;
  6. $pieces = (” “, $history);
  7. echo$history[0]; // php3
  8. echo $history[1]; // php4
  9. echo $history[1]; // php5
  10. ?>
  11.  </body>   
  12. </html>  

implode — Join array elements with a string

Example: implode() example

  1. <html>  
  2.  <body>  
  3. <?php
  4. $array= array('lastname', 'email', 'phone');
  5. $comma_separated = implode(",", $array);
  6. echo $comma_separated; /// lastname,email,phone
  7. ?>
  8.  </body>   
  9. </html>  

eXTReMe Tracker