Home » A Beginner’s Guide to PHP Explode | explode() Function

A Beginner’s Guide to PHP Explode Function | explode()

PHP explode Function

PHP Explode function mainly used for breaking a string into a PHP array. Exact syntax of PHP explode() function is given,

explode(separator,string,limit)

PHP explode Function

Parameter Email
separator Required. Specifies where to break the string
String Required. The string to split in parts
limit Possible values:
Greater than 0: – Returns an array with a maximum of limit element(s)
Less than 0: – Returns an array except for the last -limit elements()

0: – Returns an array with one element

Changelog The limit parameter was added in PHP 4.0.1, and support for negative limits were added in PHP 5.1.0
 Return Value Returns an array of strings
PHP Version 4+

Table Reference: w3schools.com

Example of PHP explode Function

Output:

Note: The “separator” parameter cannot be an empty string.

Note: This function is binary-safe.

Also Check: jQuery autocomplete ajax with Text and Image

Happy Coding..!

Was this article helpful?
YesNo

Advertisement

1 thought on “A Beginner’s Guide to PHP Explode Function | explode()”

  1. Pingback: Get Second And Third Word from Strings in PHP - PHPCODER.TECH

Leave a Reply

Your email address will not be published. Required fields are marked *