#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    Vancouver, WA, USA
    Posts
    425
    Rep Power
    0

    Challenge Parsing String


    Say I had the following info in a single string:


    PHP Code:
    $appParams='{"casino":"Sun Monte Carlo","table":"blackjack123"}'
    Yet I want my result to be equivalent to:

    PHP Code:
    $param['casino']="Sun Monte Carlo";
    $param['table']="blackjack123"
    The original string may have any number of pairs of data.

    What would be the easiest way to parse this? I have no talents with regular expressions.
  2. #2
  3. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,939
    Rep Power
    9647
    The easiest way to parse it would be to not parse it.

    json_decode

    Comments on this post

    • ttremain agrees : Great help, as always!

IMN logo majestic logo threadwatch logo seochat tools logo