php - What is this encoding called? -
i see in wordpress in database , see similar in cookie. kind of parser parses this:
a:4:{s:14:"clientsorderby";s:9:"firstname";s:12:"clientsorder";s:4:"desc";s:13:"ordersorderby";s:2:"id";s:11:"ordersorder";s:4:"desc";} i it, a=array:x=number of children s=string:x=number of characters.
is there parser built php kind of thing? why use method?
it's php's built-in serialize(), can "decoded" unserialize()
here example:
$serialized = 'a:4:{s:14:"clientsorderby";s:9:"firstname";s:12:"clientsorder";s:4:"desc";s:13:"ordersorderby";s:2:"id";s:11:"ordersorder";s:4:"desc";}'; $unserialized = unserialize( $serialized); var_dump( $unserialized); output:
array(4) { ["clientsorderby"]=> string(9) "firstname" ["clientsorder"]=> string(4) "desc" ["ordersorderby"]=> string(2) "id" ["ordersorder"]=> string(4) "desc" }
Comments
Post a Comment