Rumah >pembangunan bahagian belakang >tutorial php >php 数组和字符串的问题
请教一个php数组和字符串的转换问题。我有如下一个字符串:
<code>["approval","bbcode","emoji","english","flags","likes","simplified-chinese"]</code>
除了使用explode函数分割处理外,有没有其他的快速将其转换为数组的方法。
请教一个php数组和字符串的转换问题。我有如下一个字符串:
<code>["approval","bbcode","emoji","english","flags","likes","simplified-chinese"]</code>
除了使用explode函数分割处理外,有没有其他的快速将其转换为数组的方法。
<code>$array = json_decode('["approval","bbcode","emoji","english","flags","likes","simplified-chinese"]', true);</code>
<code>$str = '"approval","bbcode","emoji","english","flags","likes","simplified-chinese"'; preg_match_all('/\".[^,]*\"/',$str,$out); print_r($out); </code>