Core Function BinaryClone

From Sputnik Wiki
Revision as of 17:26, 19 November 2011 by UberFoX (Talk | contribs)
Jump to: navigation, search
BinaryClone( <binary-array> )

Contents

Description

Clone a binary variable 100% and return a new binary variable with exactly same data as the old one.

Parameters

binary-array

The binary variable to use.

Return Value

Success: Returns 1.

Failure: Returns 0.

Remarks

Contrary to what you might think simply doing

$binary2 = $binary1

That does not *copy* the data it will simply creates a referance to it making a change at either variable will change both so if you wish to actually copy a binary variables data you will need to use BinaryClone or BinaryMid etc.

Example

$binary = Pack("z0", "Hello World!");
$binary2 = BinaryClone($binary);
BinaryReverse($binary);
println("b1: " . Unpack("z0", $binary));
println("b2: " . Unpack("z0", $binary2));
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox