如何将像["8","14","22"]这样的字符串转换成数组?

mca*_*edo 1 php

我有一个这样的字符串:["8","14","22"]我怎么能把它变成一个数组?

Wes*_*rch 9

这恰好是JSON格式,因此使用json_decode():

$str = '["8","14","22"]';

$arr = json_decode($str);

print_r($arr);

// Output:
// Array
// (
//     [0] => 8
//     [1] => 14
//     [2] => 22
// )
Run Code Online (Sandbox Code Playgroud)