note 45404 added to function.wddx-add-vars

From: Date: Sun, 05 Sep 2004 18:20:47 +0000
Subject: note 45404 added to function.wddx-add-vars
Groups: php.notes 
Request: Send a blank email to php-notes+get-76075@lists.php.net to get a copy of this message
Here is a simple way of serializing dynamic values from an array: <?PHP //a unix timestamp $date = "1094095513"; //some data to be included $books = array('programming' => array('php','perl','java'), 'markup' => array('UML','XML','HTML') ); //stick data to an array to iterate over $data_to_serialize = array($date,$books); //create the packet $packet = wddx_packet_start("SOME DATA ARRAY"); //loop through the data foreach($data_to_serialize as $key => $data) { //create a var whith the name of the content of $key $$key = $data; wddx_add_vars($packet,$key); } echo wddx_packet_end($packet); ?> Have fun ! ---- Manual Page -- http://www.php.net/manual/en/function.wddx-add-vars.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45404 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45404&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45404&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#76075) next »