PHP serialization format
The PHP serialization format is the serialization format used by the PHP programming language. The format can serialize PHP's primitive and compound types, and also properly serializes references.[1] The format was first introduced in PHP 4.[2]
In addition to PHP, the format is also used by some third-party applications that are often integrated with PHP applications, for example by Lucene/Solr.[3]
Syntax
The syntax generally follows the pattern of one-letter code of the variable type, followed by a colon, followed by the variable value, followed by a semicolon.
Type | Serialization examples |
---|---|
Null | N; |
Boolean | b:1; b:0; |
Integer | i:685230; i:-685230; |
Floating point | d:685230.15; d:INF; d:-INF; d:NAN; |
String | s:6:"A to Z"; |
Associative array | a:4:{i:0;b:1;i:1;N;i:2;d:-421000000;i:3;s:6:"A to Z";} a:2:{i:42;b:1;s:6:"A to Z";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}} |
Object | O:8:"stdClass":2:{s:4:"John";d:3.14;s:4:"Jane";d:2.718;} |
gollark: Yes, well, I wasn't very aware of it at the time and could hardly go back and mention it to myself.
gollark: Unfortunately, I didn't write that down.
gollark: I had one, but then my future self took it.
gollark: Yes, you could probably accelerate stuff *decently* if you knew the limitations of manufacturing and whatever and introduced things in a sensible order.
gollark: The tricky thing with that is that basically all stuff relies on previously developed tech, and complex supply chains for making that.
External links
References
- "Serialization". PHP Internals Book. Retrieved 2020-07-05.
- "PHP: serialize - Manual". PHP: Hypertext Preprocessor. Retrieved 2020-07-05.
- "Response Writers | Apache Solr Reference Guide 8.5". lucene.apache.org. Retrieved 2020-07-05.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.