4

I have different php variables containing data that I want to put in one of the table in mysql database. The problem is I need to put the content in a specific format so another linked to the database can also use it. I don't know what type of format is this. It doesn't look like JSON

a:1:{i:0;s:27:"[email protected]";}



a:17:{i:0;a:7:{s:2:"id";s:1:"1";s:4:"slug";s:19:"contact-information";s:4:"name";s:19:"Contact Information";s:4:"type";s:8:"fieldset";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:1;a:7:{s:2:"id";s:1:"6";s:4:"slug";s:12:"company-name";s:4:"name";s:12:"Company Name";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:20:"Company Name is here";}i:2;a:7:{s:2:"id";s:1:"8";s:4:"slug";s:12:"contact-name";s:4:"name";s:12:"Contact Name";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:8:"Name";}i:3;a:7:{s:2:"id";s:2:"10";s:4:"slug";s:13:"email-address";s:4:"name";s:13:"Email Address";s:4:"type";s:5:"email";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:26:"[email protected]";}i:4;a:7:{s:2:"id";s:2:"12";s:4:"slug";s:15:"website-address";s:4:"name";s:15:"Website Address";s:4:"type";s:3:"url";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:25:"http://example.com";}i:5;a:7:{s:2:"id";s:2:"15";s:4:"slug";s:13:"contact-phone";s:4:"name";s:13:"Contact Phone";s:4:"type";s:5:"phone";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:12:"923246573632";}i:6;a:7:{s:2:"id";s:2:"16";s:4:"slug";s:12:"your-address";s:4:"name";s:12:"Your Address";s:4:"type";s:7:"address";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:91:"House # 2, Street 27<br>Chah Mrain<br>Lahore, Punjab 54000<br>New Zealand";}i:7;a:7:{s:2:"id";s:2:"27";s:4:"slug";s:19:"listing-information";s:4:"name";s:19:"Listing Information";s:4:"type";s:8:"fieldset";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:8;a:7:{s:2:"id";s:2:"17";s:4:"slug";s:13:"listing-title";s:4:"name";s:13:"Listing Title";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:17:"House of the Dead";}i:9;a:7:{s:2:"id";s:2:"19";s:4:"slug";s:12:"listing-type";s:4:"name";s:12:"Listing Type";s:4:"type";s:6:"select";s:7:"options";s:90:"a:4:{i:0;s:11:"Attractions";i:1;s:13:"Accommodation";i:2;s:5:"Tours";i:3;s:9:"Transport";}";s:9:"parent_id";s:1:"0";s:5:"value";s:13:"Accommodation";}i:10;a:7:{s:2:"id";s:2:"20";s:4:"slug";s:17:"listings-overview";s:4:"name";s:19:"Listing\'s Overview";s:4:"type";s:8:"textarea";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:55:"Here is the overview of listing lets check what happens";}i:11;a:7:{s:2:"id";s:2:"21";s:4:"slug";s:10:"logo-image";s:4:"name";s:10:"Logo Image";s:4:"type";s:11:"file-upload";s:7:"options";s:31:"a:1:{i:0;s:13:"png|jpe?g|gif";}";s:9:"parent_id";s:1:"0";s:5:"value";s:80:"http://example.com/connect-icon.png";}i:12;a:7:{s:2:"id";s:2:"25";s:4:"slug";s:9:"longitude";s:4:"name";s:9:"Longitude";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:13;a:7:{s:2:"id";s:2:"26";s:4:"slug";s:8:"latitude";s:4:"name";s:8:"Latitude";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:14;a:7:{s:2:"id";s:1:"2";s:4:"slug";s:12:"verification";s:4:"name";s:12:"Verification";s:4:"type";s:12:"verification";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:15;a:7:{s:2:"id";s:1:"3";s:4:"slug";s:27:"please-enter-any-two-digits";s:4:"name";s:27:"Please enter any two digits";s:4:"type";s:6:"secret";s:7:"options";s:0:"";s:9:"parent_id";s:1:"2";s:5:"value";s:2:"14";}i:16;a:7:{s:2:"id";s:1:"4";s:4:"slug";s:6:"submit";s:4:"name";s:6:"Submit";s:4:"type";s:6:"submit";s:7:"options";s:0:"";s:9:"parent_id";s:1:"2";s:5:"value";s:0:"";}}

I just want to replace the value that I have in the variables and save it in database.

1
  • Go to [jsonlint.com](jsonlint.com) and paste this json code in text area and validate, it will show You if it is valid or not. I checked with ur json it is NOT valid Commented Feb 22, 2014 at 4:56

1 Answer 1

10

That format is the result of PHP's serialize() function. You can use unserialize() to decode it.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @Barmar - I checked this here functions-online.com/unserialize.html and yes it's serialzed
Thank you Barmar, I was trying to find the format. It seems json but its not :)

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.