Home >Backend Development >PHP Problem >How to convert string into array in php

How to convert string into array in php

王林
王林Original
2020-05-28 15:41:153968browse

How to convert string into array in php

Implementation idea:

First split the string into single characters and store them in an array, and then print the array.

The specific code is as follows:

$m='woxihuanphp';
echo $res=trim(chunk_split($m,1,'.'),'.');
$arr1=explode('.',$res);
var_dump($arr1);

For more related tutorials, please visit php Chinese website.

The above is the detailed content of How to convert string into array in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to block php errorsNext article:How to block php errors