Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

wddx_serialize_vars(3) [php man page]

WDDX_SERIALIZE_VARS(3)							 1						    WDDX_SERIALIZE_VARS(3)

wddx_serialize_vars - Serialize variables into a WDDX packet

SYNOPSIS
string wddx_serialize_vars (mixed $var_name, [mixed $...]) DESCRIPTION
Creates a WDDX packet with a structure that contains the serialized representation of the passed variables. PARAMETERS
This function takes a variable number of parameters. o $var_name - Can be either a string naming a variable or an array containing strings naming the variables or another array, etc. o $... - RETURN VALUES
Returns the WDDX packet, or FALSE on error. EXAMPLES
Example #1 wddx_serialize_vars(3) example <?php $a = 1; $b = 5.5; $c = array("blue", "orange", "violet"); $d = "colors"; $clvars = array("c", "d"); echo wddx_serialize_vars("a", "b", $clvars); ?> The above example will output: <wddxPacket version='1.0'><header/><data><struct><var name='a'><number>1</number></var> <var name='b'><number>5.5</number></var><var name='c'><array length='3'> <string>blue</string><string>orange</string><string>violet</string></array></var> <var name='d'><string>colors</string></var></struct></data></wddxPacket> PHP Documentation Group WDDX_SERIALIZE_VARS(3)

Check Out this Related Man Page

SUBSTR_REPLACE(3)							 1							 SUBSTR_REPLACE(3)

substr_replace - Replace text within a portion of a string

SYNOPSIS
mixed substr_replace (mixed $string, mixed $replacement, mixed $start, [mixed $length]) DESCRIPTION
substr_replace(3) replaces a copy of $string delimited by the $start and (optionally) $length parameters with the string given in $replace- ment. PARAMETERS
o $string - The input string. An array of strings can be provided, in which case the replacements will occur on each string in turn. In this case, the $replacement, $start and $length parameters may be provided either as scalar values to be applied to each input string in turn, or as arrays, in which case the corresponding array element will be used for each input string. o $replacement - The replacement string. o $start - If $start is positive, the replacing will begin at the $start'th offset into $string. If $start is negative, the replacing will begin at the $start'th character from the end of $string. o $length - If given and is positive, it represents the length of the portion of $string which is to be replaced. If it is negative, it rep- resents the number of characters from the end of $string at which to stop replacing. If it is not given, then it will default to strlen( $string ); i.e. end the replacing at the end of $string. Of course, if $length is zero then this function will have the effect of inserting $replacement into $string at the given $start offset. RETURN VALUES
The result string is returned. If $string is an array then array is returned. EXAMPLES
Example #1 Simple substr_replace(3) examples <?php $var = 'ABCDEFGH:/MNRPQR/'; echo "Original: $var<hr /> "; /* These two examples replace all of $var with 'bob'. */ echo substr_replace($var, 'bob', 0) . "<br /> "; echo substr_replace($var, 'bob', 0, strlen($var)) . "<br /> "; /* Insert 'bob' right at the beginning of $var. */ echo substr_replace($var, 'bob', 0, 0) . "<br /> "; /* These next two replace 'MNRPQR' in $var with 'bob'. */ echo substr_replace($var, 'bob', 10, -1) . "<br /> "; echo substr_replace($var, 'bob', -7, -1) . "<br /> "; /* Delete 'MNRPQR' from $var. */ echo substr_replace($var, '', 10, -1) . "<br /> "; ?> Example #2 Using substr_replace(3) to replace multiple strings at once <?php $input = array('A: XXX', 'B: XXX', 'C: XXX'); // A simple case: replace XXX in each string with YYY. echo implode('; ', substr_replace($input, 'YYY', 3, 3))." "; // A more complicated case where each replacement is different. $replace = array('AAA', 'BBB', 'CCC'); echo implode('; ', substr_replace($input, $replace, 3, 3))." "; // Replace a different number of characters each time. $length = array(1, 2, 3); echo implode('; ', substr_replace($input, $replace, 3, $length))." "; ?> The above example will output: A: YYY; B: YYY; C: YYY A: AAA; B: BBB; C: CCC A: AAAXX; B: BBBX; C: CCC NOTES
Note This function is binary-safe. SEE ALSO
str_replace(3), substr(3), String access and modification by character. PHP Documentation Group SUBSTR_REPLACE(3)
Man Page