-4

I tried

$string = "['1','2','3']";
$string = explode("'",$string);

I got

"[1,2,3]"

but i want output like this

[1,2,3]

can you help me to achive that output?

  • A function in [this answer](https://stackoverflow.com/a/47658246/7644018) may help, and an example using that function with your array [is here](https://phpize.online/sql/mysql57/undefined/php/php81/2b8c51a6adbdcbe18e1bd41acfaaded9/) ... kindly consider upvoting that answer if you find it to be useful. – Paul T. Jun 04 '22 at 04:46
  • `array_map('intval', json_decode($string, true));` – Sammitch Jun 04 '22 at 04:58

0 Answers0