serialize() (was Re: [PHPLIB-DEV] Re: [PHPLIB] phplib - changes proposal) From: Sascha Schumann (sascha <email protected>)
Date: 10/28/99

On Thu, Oct 28, 1999 at 12:42:31PM +0200, Boris Erdmann wrote:
>
> The old serializer should painlessly be replaceble by
> the following (maybe with little modifications at
> where _serialize() is called):

    Just to throw an idea into the discussion: Why don't we use
    PHP's built-in serialization for primitive data types?

    There are a number of advantages:

    - eval leaks memory
    - ereg_replace is slow

    For example, Boris' code used

    eval('$ser.="$$var=\'".ereg_replace("\'","\\\'",$'.$var.')."\';";');
    
    this could be rewritten as

    $ser .= "\$$var=unserialize('".serialize($$var)."');";

    Do I miss anything?

-- 

Regards,

Sascha Schumann Consultant - PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>. To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in the body, not the subject, of your message.