0

I get this variable from from-data in postman:

$filter = "[234,321,22,4]"

but It's an string.

I want to convert $filter to this:

$filter = [234,321,22,4]

It should be an array with numeric type, not string.

Vahid
  • 3,352
  • 2
  • 34
  • 42
  • 5
    if it's `json` just use `json_decode($filter,true);` to convert it to array. – Rasclatt Dec 28 '15 at 07:39
  • 2
    Possible duplicate of [How to convert JSON string to array](http://stackoverflow.com/questions/7511821/how-to-convert-json-string-to-array) – Rasclatt Dec 28 '15 at 07:41
  • 1
    I have another varaibles and It's not a raw json. I put it in params. I have another inputs like category=5&limit=2&filter=[34,23,12,54]&offset=1 – Vahid Dec 28 '15 at 07:44
  • 1
    Thanks, I didn't know json_decode works on variables. working well NOW ;) – Vahid Dec 28 '15 at 07:48

0 Answers0