Core Function BinaryExpand

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
UberFoX (Talk | contribs)
(Created page with "<pre> BinaryExpand( <binary-array> ) </pre> === Description === Reverse the order bytes a binary variable. === Parameters === ==== binary-array ==== The binary variable to u...")
Newer edit →

Revision as of 00:01, 27 July 2014

BinaryExpand( <binary-array> )

Contents

Description

Reverse the order bytes a binary variable.

Parameters

binary-array

The binary variable to use.

Return Value

Success: Returns string of the expanded binary.

Failure: Returns empty string.

Remarks

This converts a binary variable into a string of numbers followed by text so it is easy to read and understand.

This is especially good when making a Client/Server program and you wish to see what information you are getting or sending.

Example

// Create a large binary that contains some text
$bin = Pack("z0iNnz0Nz0", "Hello World!", 100, 200, 700, "Cat", 1337, "Hello world!!!");
// Print it out
say BinaryExpand($bin);
// Prints
// 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 64 00 00 00 Hello World!d...
// 00 00 00 C8 02 BC 43 61 74 00 00 05 39 48 65 6C ...È..Cat...9Hel
// 6C 6F 20 77 6F 72 6C 64 21 21 21 -- -- -- -- -- lo world!!!
//
// See how it makes it easier to see whats inside the binary?
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox