Encode¶
To encode is to transform a piece of data, from a human readable format to a specialized format.
The conversion is lossless, and shall be reverted with a decode operation.
<?php
// convert an array to a JSON string
// This is also called 'encoding', and may be decoded
$array = ['a' => 1];
$json = json_encode($array);
$original = json_decode($json);
?>
See also PHP: Useful Encoding and decoding Functions You Need to Know.