Topic: How to convert string to array in php?

Hello Guys, How to convert string to array?

Is this should be like this?

arr[0]=this
      arr[1]=is
      arr[2]=string

Re: How to convert string to array in php?

Youcan perform the conversion using PHP-function:

preg_split("~\s~", "this is string");
Best regards,
CN Support team

Re: How to convert string to array in php?

Is preg_split still valid in php v7+

Re: How to convert string to array in php?

Yes it it still valid in v7.0

Re: How to convert string to array in php?

Good to know, thx.

Re: How to convert string to array in php?

No problem :-)

7 (edited by evenikiforova1982 2019-02-22 04:33:39)

Re: How to convert string to array in php?

Yes i agree..using preg_split command will easily covert array to a string.Cheers.

Re: How to convert string to array in php?

array preg_split( $pattern, $subject, $limit, $flag ) This will work fine in your problem Tellthebell.com

9 (edited by Fuentest 2020-05-11 03:00:17)

Re: How to convert string to array in php?

PHP Explode () Function Basically the PHP explode () function is used to split or break strings to substrings by a given delimiter in PHP. This returns an array of broken substrings that you can assign to arrays variable in PHP. In other words, the PHP explode () function is used to convert a string or a comma-separated string into an array mcdvoice login