WDDX
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | WDDX | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3378@lists.php.net to get a copy of this message | ||
Stig, you mentioned you would have a look at the wddx_unserialize()
function with respect to the XML aspect. Are you still planning on doing
that in the near future? I want to get an interactive demo set up between
CF, ASP, Perl, Python and PHP with apps all sending data back and forth to
each other.
The current state of the PHP implementation looks like this:
$a = 1;
$b = "abc";
$str = wddx_serialize(array("a" => $a, "b" => $b));
unset($a);
unset($b);
$str = '$tmp = '.wddx_unserialize($str).";";
eval($str);
while(list($k,$v)=each($tmp)) {
$$k=$v;
}
echo $a;
echo $b;
This correctly serializes and deserializes $a and $b. But it is a rather
ugly way of doing it.
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?
-Rasmus
--
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