Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Extract data with regex php

My string :

a:3:{i:0;s:9:"John";i:1;s:9:"Doe";i:2;s:22:"Smith";}

I want to extract John, Doe, Smith

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If it’s an original string that was serialized from an object, you can try to unserialize it

$data = 'a:3:{i:0;s:4:"John";i:1;s:3:"Doe";i:2;s:5:"Smith";}';
print_r(unserialize($data));
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading