1

I have a string like this

$string = '["_MG_0774.JPG","1.jpg","3.jpg"]';

how can I convert it into smaller string to get these 3 elements? The console I expected is that

$str1 = '_MG_0774.JPG'
$str2 = '1.jpg'
$str3 = '3.jpg'

Thanks you for your help!

Tùng Nguyễn
  • 109
  • 1
  • 12
  • 1
    json_decode should be fine? It will give you an array, so you could do like `list($str1,$str2,$str3) = json_decode($string,true);` I wouldn't answer as there are already tons of duplicates on how to parse JSON. – nice_dev Oct 01 '19 at 09:31
  • thank you I will check it again – Tùng Nguyễn Oct 01 '19 at 15:28

0 Answers0