2

In mysql database, have data serialized by php as below:

"a:564:{s:13:\"caltime\";s:6:\"65.26\";  

I use Rmysql to query these data, but donot know how to unserialize them in R.
Thank for any help!

jackson883
  • 71
  • 9
  • For anyone else that ends up here, I found [this](https://stackoverflow.com/a/44719384/3473055) answer useful – Dylan I Feb 25 '22 at 11:51
  • Does this answer your question? [How to read PHP serialize() data in R](https://stackoverflow.com/questions/38820191/how-to-read-php-serialize-data-in-r) – Dylan I Feb 25 '22 at 11:52

2 Answers2

0

MySQL doesn't have any inbuilt function to unserialize data. You can't do it. You need to do from application level

Pramod Patil
  • 2,704
  • 2
  • 14
  • 20
0

if my data is :

$a= array( '1' => 'elem 1', '2'=> 'elem 2', '3'=>' elem 3');
$b=serialize($a);

then print_r($a) produce following o/p:

a:3:{i:1;s:6:"elem 1";i:2;s:6:"elem 2";i:3;s:7:" elem 3";}

and then print_r($b) produce following o/p:

Array ( [1] => elem 1 [2] => elem 2 [3] => elem 3 ) 

i hope its help you