Atitit PHP serializing PHP Serialize serialization and JSON serialization

Source: Internet
Author: User

atitit php serialization serialize serialization and json serialization for PHP

php identifies different types of data with different letters, using serialized PHP with the Yahoo development website
the Yahoo! Web Services article gives all the letter labels and their meanings:
A-array
B-boolean
d-double
I-integer
O-common Object
r-reference
s-string
C-custom Object
O-class
N-null
R-pointer Reference
U-unicode String
N represents NULL, while b,d,i,s

Author :: ★ (Attilax) >>>    nickname : old-Wow paw   (   full name:: ATTILAX AKBAR AL RAPANUI&NBSP, Attilax &NBSP, " "  Al   Rapa Nui &NBSP,   Kanji name: Ayron, Email:[email protected]

reprint Please indicate source: http://www.cnblogs.com/attilax/

4.1. Serialization of arrays
Arraysare usually serialized as:
a:<n>:{<key 1><value 1><key 2><value 2>...<key n><value n>}
where <n> represents the number of array elements,<key 1>,<key 2>......<key n> represents the array subscript, <value 1> , <value
2>......<value n> represents the value of the array element corresponding to the subscript.
The subscript type can only be integer or string, and the serialized format is the same format as the integer and string data after serialization.
The array element value can be any type, and its serialized format is the same as the serialized format of the corresponding type.
4.2. Serialization of Objects
Objects (object) are usually serialized as:
o:<length>: "<class name>": <n>:{<field name 1><field value 1><field name
2><field Value 2>...<field name N><field value N>}
where <length> represents the string length of the object's class name <class name> . <n> represents the number of fields in the object 1 . These fields
include var,public,protected , and private in the class in which the object resides and its ancestor class the declared field, but does not include Static and the
The static field of the const declaration. This means that only the instance (instance) field.
<filed name 1>,<filed name 2>......<filed name N> represents the field name for each field, and < Filed value 1>,
<filed value 2>......<filed value n> represents the field value corresponding to the field name.
The field name is a string type, and the serialized format is the same as the format after the string data is serialized.
The field value can be of any type, and its serialized format is the same as the serialized form of the corresponding type.
but the serialization of field names is related to the visibility of their declarations, and the following focuses on serialization of field names.

PHP serialization _serialize_ format detailed - low-key walk - Blog channel -CSDN. Net.html

Atitit PHP serializing PHP Serialize serialization and JSON serialization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.