Top "Explode" questions

explode() is a PHP function that splits a string based on a delimiter, returning an array.

how to convert array values from string to int?

$string = "1,2,3" $ids = explode(',', $string); var_dump($ids); returns array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "3" } I need for …

php arrays string integer explode
Php multiple delimiters in explode

I have a problem, I have a string array, and I want to explode in different delimiter. For Example $example = …

php explode
Explode string by one or more spaces or tabs

How can I explode a string by one or more spaces or tabs? Example: A B C D I want …

php regex explode
Mysql where id is in array

I have a string of ids like 1,2,3,4,5 and I want to be able to list all rows in mysql where …

php mysql arrays explode
PHP: Split string into array, like explode with no delimiter

I have a string such as: "0123456789" and need to split EACH character into an array. I for the hell of …

php string arrays split explode
How can I explode and trim whitespace?

For example, I would like to create an array from the elements in this string: $str = 'red, green, blue ,orange'; …

php explode trim higher-order-functions
php explode: split string into words by using space a delimiter

$str = "This is a string"; $words = explode(" ", $str); Works fine, but spaces still go into array: $words === array ('This', 'is', …

php arrays regex preg-match explode
Add a prefix to each item of a PHP array

I have a PHP array of numbers, which I would like to prefix with a minus (-). I think through …

php arrays explode prefix implode
Explode to array and print each element as list item

I have a set of numbers in a table field in database, the numbers are separated by comma ','. …

php foreach explode
How to go to next record in foreach loop

foreach ($arr as $a1){ $getd=explode(",",$a1); $b1=$getd[0]; } In above code, if that $getd[0] is empty i want to …

php loops foreach explode