Speed up development with full-stack environments for every branch.

Learn More

How to add variables to a WDDX packet [PHP]

Forked from How to Start / End a WDDX packet.

42 Runs 67 Views 15 Copies


gtsolutions 373

published 4 years ago

PHP WDDX - How to add variables to a WDDX packet

//Start a new WDDX packet with structure inside it
//the argument is an optional comment
$packet_id = wddx_packet_start("PHP");

//add an integer variable
$var1 = 15;
wddx_add_vars($packet_id, "var1");

//add an array
$cities = array("Austin", "Novato", "Seattle");
wddx_add_vars($packet_id, "cities");

//End a WDDX packet with the specified ID
//return the string containing the WDDX packet. 
$packet = wddx_packet_end($packet_id);
echo htmlentities($packet);
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).