What PHP7 function is used to break a string into an array?

A1WEBSITEPRO QuestionsCategory: PHPWhat PHP7 function is used to break a string into an array?
Cal Michaels asked 5 years ago

What PHP7 function is used to break a string into an array?

What PHP7 function is used to break a string into an array? was last modified: November 28th, 2018 by Cal Michaels
1 Answers
Best Answer
Maximus Mccullough Staff answered 5 years ago

If you need to break a string into an array, then you will want to use the explode() function. It is a binary safe function with a syntax as follows:
explode(separator,string,limit)
Keep in mind that the “separator” parameter must not be an empty string. The only optional parameter is the “limit” and it tells the number of array elements to return. The limit has three variations that can be used.

  • 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

Answer for What PHP7 function is used to break a string into an array? was last modified: November 28th, 2018 by Maximus Mccullough