Strings
abstract class Strings (View source)
Common String Functions
Methods
String Shift
String Pop
Parse SSH2-style string
Create SSH2-style string
Convert binary data into bits
Convert bits to binary data
Switch Endianness Bit Order
Increment the current string
Find whether the type of a variable is string (or could be converted to one)
Details
static string
shift(string $string, int $index = 1)
String Shift
Inspired by array_shift
static string
pop(string $string, int $index = 1)
String Pop
Inspired by array_pop
static mixed
unpackSSH2(string $format, string $data)
Parse SSH2-style string
Returns either an array or a boolean if $data is malformed.
Valid characters for $format are as follows:
C = byte b = boolean (true/false) N = uint32 s = string i = mpint L = name-list
uint64 is not supported.
static mixed
packSSH2(string[] ...$elements)
Create SSH2-style string
static string
bits2bin(string $x)
Convert binary data into bits
bin2hex / hex2bin refer to base-256 encoded data as binary, whilst decbin / bindec refer to base-2 encoded data as binary. For the purposes of this function, bin refers to base-256 encoded data whilst bits refers to base-2 encoded data
static string
bin2bits(string $x)
Convert bits to binary data
static string
switchEndianness(string $x)
Switch Endianness Bit Order
static string
increment_str(string $var)
Increment the current string
static bool
is_stringable(string|object $var)
Find whether the type of a variable is string (or could be converted to one)