downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

wddx_deserialize> <Funções da WDDX
[edit] Last updated: Sat, 25 May 2013

view this page in

wddx_add_vars

(PHP 4, PHP 5)

wddx_add_varsAdiciona variáveis a um pacote WDDX com o IP especificado

Descrição

bool wddx_add_vars ( resource $packet_id , mixed $var_name [, mixed $... ] )

Serializa as variáveis passadas e adiciona o resultado para o pacote escolhido.

Parâmetros

Essa função recebe um número variável de parâmetros.

packet_id

Um pacote WDDX, retornado por wddx_packet_start().

var_name

Pode ser um string com o nome de uma variável ou um array contendo strings com nomes de variáveis ou até outro array, recursivamente.

...

Valor Retornado

Retorna TRUE em caso de sucesso ou FALSE em caso de falha.



add a note add a note User Contributed Notes wddx_add_vars - [1 notes]
up
0
maciek at webenlinea dot com
8 years ago
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 !

 
show source | credits | sitemap | contact | advertising | mirror sites