Simple Serializer implementation in PHP