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

By | June 3, 2020

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

Subscribe For Latest Updates

Sign up to best of PHP Code Solutions, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Reply

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