search

Home  >  Q&A  >  body text

How to split this array

    "images": [
        "1,2,3"
    ]

I want to split it into ['img':1,img:2,img:3]

小乔小乔2030 days ago1363

reply all(7)I'll reply

  • 勇敢的心

    勇敢的心2019-07-04 10:01:22

    This is in json format, you have to convert it into an array first and then process it

    reply
    0
  • 小破孩

    小破孩2019-07-01 15:00:51

    list(img_one,img_two,img_three) = explode(',',$image);

    Try it out

    reply
    0
  • 小乔

    OK, thanks

    小乔 · 2019-07-01 15:02:23
  • 小乔

    小乔2019-07-01 10:47:09

    Doesn't seem to work

    reply
    0
  • ringa_lee

    Is this js?

    ringa_lee · 2019-07-01 11:13:20
    小乔

    It's not js, it's the content in the database

    小乔 · 2019-07-01 15:01:56
  • ringa_lee

    ringa_lee2019-07-01 10:21:02

    array_flip, just apply this function

    reply
    0
  • Cancelreply