Skip to content
Várnagy Zoltán edited this page Sep 11, 2026 · 5 revisions
class Tools

Useful static functions

GET Value used, when a property is not changed, just read.

U16L UTF16LE encoding

UTF UTF-8 encoding

function g($arr,$fld)

Warning-less $arr[ $fld ]( $fld ) or null

function gg($arr,$fld)

Returns $arr[ $fld ]( $fld ) or throws EVygu if not exists

function ga($arr,array $flds)

Returns the first existing $arr[ $f ]( $f ) from $flds or null

function gd($arr,$fld,$def)

Returns $arr[ $fld ]( $fld ), or if not exists, $def

function arrayRemove( array & $arr, $x )

Removes first occurence $x from $arr (strict)

function bits($x,$at,$n)

Some bits of an integer

  • $x The integer

  • $at First returned bit index

  • $n Number of returned bits

  • return The queried bits as integer

function withBits($x,$at,$n,$v)

An integer with some bits changed

  • $x The input integer

  • $at First changed bit index

  • $n Number of changed bits

  • $v Changed bit values

  • return A new integer with bits changed

function div($a,$b)

Integer division

function divu($a,$b)

Integer division rounding up

function utf($uni)

An utf-8 character from Unicode value

function ulen($s)

Char length of an utf8 string

function ulower($s)

Lowercase utf8 string

function notImpl( $obj, $meth )

Throws an EVygu saying $obj not implements $meth

function sysBits()

Number of bits in system processor (32,64)

function loadFile($fname)

Loads a file or throws EVygu

function debug()

Shows debug values for all arguments on STDERR

function str($x)

Converts any value to string

function cIsNull($x)

Is $x an FFI NULL value

function cstr( \FFI\CData $x )

Converts FFI value to string

function isAssoc($x)

Is $x an associative array

function type($x)

Type (or class name) of $x

Clone this wiki locally