0

Hi i am having original array as.............

array( 
       array( "task" => "rose", 
              "duration" => 1.25,
              "user" => 15 
            ),
       array( "task" => "daisy", 
              "duration" => 0.75,
              "user" => 25,
            ),
       array( "task" => "orchid", 
              "duration" => 1.15,
              "user" => 7 
            ),
           array( "task" => "sunflower", 
              "duration" => 1.50,
              "user" => 70 
            )

     );

after encoding it become string as............

0=task=rose&39avfy;
duration=1.25&39avfy;
user=15&39avfy;
&1=task=daisy&39avfy;
duration=0.75&39avfy;
user=25&39avfy;
&2=task=orchid&39avfy;
duration=1.15&39avfy;
user=7&39avfy;
&3=task=sunflower&39avfy;
duration=1.5&39avfy;
user=70&39avfy;

now i want the original array back from this string....... so please if anyone knows then help me...........

6
  • What is the purpose of this operation? Editing specific elements in that array? Because you can do it directly on the array... Commented Mar 23, 2011 at 10:01
  • How did you transfrom your array into the string? Commented Mar 23, 2011 at 10:02
  • please check my post..here i gave how i did all this stuff....stackoverflow.com/questions/5401471/… Commented Mar 23, 2011 at 10:06
  • One answer at the post in the link you gave suggested that you use json_encode() and json_decode() functions. Have you tried using those? Commented Mar 23, 2011 at 10:26
  • no that is final output......before that only i need to do encode Commented Mar 23, 2011 at 10:52

3 Answers 3

0

I'm repeating my answer from your other question:

Why don't you use json_encode? Just do

$str=json_encode($array);

Then, send the data, and at the other end do

$array=json_decode($str);
0

You may consider using strtok or explode function, with parameters as &39avfy;. Then use the explode function again with parameters "=".

0

Are you trying to pass an array to POST or GET data, if yes, why not using serialize ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.