JSON vs. Serialized Array in database [closed]

  1. JSON encode() & decode()
    • PHP Version >= 5.0.0
      • Nesting Limit of 20.
    • PHP Version >= 5.2.3
      • Nesting Limit of 128.
    • PHP Version >= 5.3.0
      • Nesting Limit of 512.
    • Small footprint vs PHP’s serialize’d string.
  2. serialize() & unserialize()
    • PHP Version >= 4.0.0
      • Methods are not lost on PHP Datatype Object.
      • __wakeup() magic method called on any object being unserialize. (VERY POWERFUL)
      • It has been noted that it is some times best the base64 encode strings put into the database, and base64 decode strings taken out of the database with this function, as there are some issues with the handling of some white space characters.

The choice is yours.

Leave a Comment