Error:
Notice: unserialize() [function.unserialize]: Error at offset 0 of 126 bytes in C:\wamp\www\web_service\client.php on line 224
false
Code 1:
$data = array('table'=>'users', 'operation'=>'select', 'uid'=>'yoyo');
$data = serialize($data);
print_r(unserialize($data));
Code 2:
$data = array('table'=>'users', 'operation'=>'select', 'uid'=>'yoyo');
$data = base64_encode(serialize($data));
print_r(unserialize(base64_decode($data)));
Both of above gives same error. Any idea why?
Thanks
Looked at these;
$data = array('table'=>'users', 'operation'=>'select', 'uid'=>'yoyo');
$data = json_encode($data);
// Use either as array
print_r((array) json_decode($data));
//Or Json
echo $data;
Apparently JSON is a better solution so I use it instead. Thanks for contributions.