2

I have looked inside Wordpress database.

Example:

In wp_options table, option_name column, active_plugins row, its option_value is

a:7:{i:0;s:27:"clean-html/cleanup-html.php";i:1;s:59:"force-regenerate-thumbnails/force-regenerate-thumbnails.php";i:2;s:36:"google-sitemap-generator/sitemap.php";i:3;s:39:"thumbnail-upscale/thumbnail-upscale.php";i:4;s:24:"wordpress-seo/wp-seo.php";i:5;s:27:"wp-super-cache/wp-cache.php";i:6;s:19:"wptouch/wptouch.php";}

I guess that a is array, 7 is array's length, i is integer, s is string, etc.

What is this data type called? How to generate (encode) to store and how to read (decode) to use?

I think this storing solution perfectly fits to what I'm doing in my current project.

1

1 Answer 1

2

I have looked inside Wordpress database.

Never do that unless you need to have an external utility to be able to read data from the DB. For wordpress development always use the proper API for what you need, there was a lot of time invested into making the APIs efficient and there is no need to reinvent the wheel.

In options case just use the options API to set and retrieve the option values. And let them handle how to best write the data to the DB.

1
  • Thank you for reminding. My current project is not based on Wordpress, it's just PHP at all. I'm looking for an effcient storing data solution, and I find out WP's one is just good enough for me now. Thru API, obviously you just get what data you need, not what it looks like in database. Commented Oct 9, 2014 at 5:16

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.