Re: Windows development

From: Date: Sun, 10 Jan 1999 06:34:00 +0000
Subject: Re: Windows development
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-3439@lists.php.net to get a copy of this message
At 01:13 AM 1/10/99 -0500, Rasmus Lerdorf wrote: >where he says he thinks it is a bad idea to import variables directly >into the symbol table under all circumstances. I don't really agree with >this though. PHP has always imported all sorts of crud into its symbol >table by default. As long as there is a way to turn off the behaviour, I >don't see the problem, and it certainly is more convenient for users which >is the idea. This is the message I found in the archive. >I would prefer to have it look more like this: > > $a = 1; > $b = "abc"; > $str = wddx_serialize($a,$b); > unset($a); > unset($b); > > wddx_unserialize($str); > echo $a; > echo $b; > >Perhaps an optional argument on wddx_unserialize() which tells the >function what to do if any of the variables it is about to create already >exists. Like a no clobber flag. And perhaps also a rename option. eg. > > wddx_unserialize($str) /* default - overwrite existing vars */ > wddx_unserialize($str,1) /* do not overwrite existing vars */ > wddx_unserialize($str,2) /* rename to $wddx_a and $wddx_b */ > >Any thoughts or suggestions? I have a few. How will wddx_serialize() know what the variable names are for the variables that it is passed? A couple of custom functions I put into PHP operate on variables in a similar manner, and what I do is pass them the variable names instead of values like this: $arr = compact("a", "b"); This way it knows the variable name and can retrieve the value from the symbol table. It also supports the alternate syntax of compact(arrray("a", b")) if you have an array containing the variable names. Do you think something like this could work for wddx_serialize? wddx_unserialize seems straightforward enough and should not present any problems. I could certainly work on this functionality... -Andrey -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3439) next »