>
>
> >
> > I gave one use case in an earlier message: many serialisation formats
> have
> > a different form for ordered lists vs key-value pairs. As an obvious
> > example, look at JSON arrays and objects, and many other formats have
> > similar types.
> >
>
> Ah, so you would do something like
>
> private serializeArray(array $data) {
>    return is_vector($data) ? $this->serializeVector($data) :
> $this->serializeAssoc($data);
> }
>
> is that right?


I do this to pack php arrays into MessagePack's arrays/maps:
https://github.com/rybakit/msgpack.php/blob/master/src/Packer.php#L112-L114



-- 
Thank you and best regards,
Eugene Leonovich

Reply via email to