Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>What serialization is?</strong></p> <p>Serialization is objects encoding into other language. For example you have an array in PHP like this:</p> <pre><code>$array = array("a" =&gt; 1, "b" =&gt; 2, "c" =&gt; array("a" =&gt; 1, "b" =&gt; 2)); </code></pre> <p>And then you want to store it in file or send to other application.</p> <p>There are multiple choices of languages, but the idea is the same: That array has to be encoded (or translated) into text or bytes, that can be written to file or sent via network. For example, if you</p> <pre><code>$data = serialize($array); </code></pre> <p>you will get this:</p> <pre><code>a:3:{s:1:"a";i:1;s:1:"b";i:2;s:1:"c";a:2:{s:1:"a";i:1;s:1:"b";i:2;}} </code></pre> <p>This is PHP's particular serializing format that PHP understands and it works vice versa so you are able to use it to deserialize objects. For example, you stored an array in file and you want it back in your code:</p> <pre><code>$array = unserialize($data); </code></pre> <p>But you could choose another serialization format, for example, JSON.</p> <pre><code>$json = json_encode($array); </code></pre> <p>will give you this:</p> <pre><code>{"a":1,"b":2,"c":{"a":1,"b":2}} </code></pre> <p>Result that is not only easily saved, read by human eye or sent via network, but is understandable to almost every other language (Javascript, Java, C#, C++.....)</p> <p><strong>Conclusion</strong> Serialization is object translation to other language, in case you want to store or share data.</p> <p><strong>Are there any situations, where you cannot do anything, but serialize it?</strong></p> <p>No. But serialization usually makes things easier.</p> <p><strong>Are JSON and PHP format the only possible formats?</strong> No, no, no and one more time no. There are plenty of formats.</p> <ul> <li>XML which has successors like SOAP, WSDL, etc (those have particular purpose)</li> <li>Bytes</li> <li>...</li> <li>...</li> <li>...</li> <li>Your own formats (you can create your own format for serialization and use it, but that is a big thing to do and is not worth it, most of the time)</li> </ul> <p>Hope I helped!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload