\funcs

Functions

A set of function to transform/check/etc data

Summary

Methods
Properties
Constants
is_in_array()
exp()
imp()
arrInArr()
giveArray()
strCheck()
recursive_unset()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

is_in_array()

is_in_array(array  $array, string  $key, string  $key_value) : boolean

Is In Array

Recursively checks array for [key => value] pair existance

Parameters

array $array

Array to check

string $key

Key name

string $key_value

Pair's value

Returns

boolean —

If true - there is such pair

exp()

exp(string  $d, boolean  $e = false) : array

Explode

Turn string to array

TF1: |1||4||6| => [1, 4, 6]

TF2: |a::1||b::4||c::6| => ["a" => 1, "b" => 4, "c" => 6]

Parameters

string $d

Input string

boolean $e

Enabe TF2 mode (if true)

Returns

array —

Result. Also it could be False if it's unexplodable string

imp()

imp(array  $d, boolean  $e = false) : string

Implode

Turn array to string

TF1: [1, 4, 6] => |1||4||6|

TF2: ["a" => 1, "b" => 4, "c" => 6] => |a::1||b::4||c::6|

Parameters

array $d

Input array

boolean $e

Enable TF2 mode

Returns

string —

Result

arrInArr()

arrInArr(array  $a) : array

Arrays in array

Get all subarrays in array

arrInArr([1,[2,3],4,[5],6,[7,[89]]]) => [[2,3],[5],[7,[89]]]

Parameters

array $a

Input array

Returns

array —

Subarrays

giveArray()

giveArray(array  $a, string  $k) : mixed|boolean

Get array key

Gets an array key from an array

Parameters

array $a

Requested array

string $k

Key

Returns

mixed|boolean —

false If doesn't exist

strCheck()

strCheck(string  $q, array  $o) : boolean

String Checks

Checks string by parameters

Parameters

string $q

String to check

array $o

Check settings

  • min [int] - MIN string length
  • max [int] - MAX string length
  • regex [string] - RegExp, which the string should match
  • symbols [string] - Which symbols the string must contain (/^([SYMBOLS]+)?$/)
  • numeric [bool] - Is string numeric
  • range [array[int, int]] - Numeric string max-min values

Returns

boolean —

If true - correct

recursive_unset()

recursive_unset(array  $array, string  $unwanted_key) : void

Recursive Unset

Remove key from array and all subarrays

Warning: This function changes given variable directly and doesn't return anything

Parameters

array $array

Array to modify

string $unwanted_key

Key name to remove