Date: 01/10/99
- Next message: Bug Database: "[PHP-DEV] Bug #1022 Updated: php 3.0.6 won't compile with new version of mysql 3.22.14"
- Previous message: Rasmus Lerdorf: "Re: [PHP-DEV] Windows development"
- In reply to: Rasmus Lerdorf: "Re: [PHP-DEV] Windows development"
- Next in thread: Rasmus Lerdorf: "Re: [PHP-DEV] Windows development"
- Reply: Rasmus Lerdorf: "Re: [PHP-DEV] Windows development"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 <email protected> For help: php-dev-help <email protected>
- Next message: Bug Database: "[PHP-DEV] Bug #1022 Updated: php 3.0.6 won't compile with new version of mysql 3.22.14"
- Previous message: Rasmus Lerdorf: "Re: [PHP-DEV] Windows development"
- In reply to: Rasmus Lerdorf: "Re: [PHP-DEV] Windows development"
- Next in thread: Rasmus Lerdorf: "Re: [PHP-DEV] Windows development"
- Reply: Rasmus Lerdorf: "Re: [PHP-DEV] Windows development"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

