10.12 WDDX Deserialization


You have a WDDX-encoded string and you want to get your data back from it.

Technique

Use the wddx_deserialize() function to decode a WDDX string into a PHP variable:

 <?php $favorite_tv_shows = array("M*A*S*H", "Seinfeld", "The Simpsons"); $text = wddx_serialize_vars($favorite_tv_shows); $favorite_tv_shows_again = wddx_deserialize($text); foreach ($favorite_tv_shows_again as $show) {     print "$show\n<br>\n"; } ?> 

Comments

The wddx_deserialize() function takes a WDDX packet and converts it to an array of equivalent PHP variables . One neat use of wddx_deserialize() is to take WDDX packets generated by other languages and translate them into PHP variables.



PHP Developer's Cookbook
PHP Developers Cookbook (2nd Edition)
ISBN: 0672323257
EAN: 2147483647
Year: 2000
Pages: 351

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net