inc\classes\funcs.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
Utils and funcs

Data manipulating universal functions

Author
Sergey Dilong  
License
GPL-2.0  
Package
Temply-Account\Core  

\funcs

Package: Temply-Account\Core
Functions

A set of function to transform/check/etc data

Author
Sergey Dilong  
License
GPL-2.0  

Methods

methodpublicarrInArr(array $a) : array
static

Arrays in array

Get all subarrays in array

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

Parameters
NameTypeDescription
$aarray

Input array

Returns
TypeDescription
arraySubarrays
methodpublicexp(string $d, boolean $e = false) : array
static

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
NameTypeDescription
$dstring

Input string

$eboolean

Enabe TF2 mode (if true)

Returns
TypeDescription
arrayResult. Also it could be False if it's unexplodable string
methodpublicgiveArray(array $a, string $k) : mixed | boolean
static

Get array key

Gets an array key from an array

Parameters
NameTypeDescription
$aarray

Requested array

$kstring

Key

Returns
TypeDescription
mixed | boolean`false` If doesn't exist
Details
Deprecated
 
methodpublicimp(array $d, boolean $e = false) : string
static

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
NameTypeDescription
$darray

Input array

$eboolean

Enable TF2 mode

Returns
TypeDescription
stringResult
methodpublicis_in_array(array $array, string $key, string $key_value) : boolean
static

Is In Array

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

Parameters
NameTypeDescription
$arrayarray

Array to check

$keystring

Key name

$key_valuestring

Pair's value

Returns
TypeDescription
booleanIf `true` - there is such pair
methodpublicrecursive_unset(array $array, string $unwanted_key) : void
static

Recursive Unset

Remove key from array and all subarrays

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

Parameters
NameTypeDescription
$arrayarray

Array to modify

$unwanted_keystring

Key name to remove

methodpublicstrCheck(string $q, array $o) : boolean
static

String Checks

Checks string by parameters

Parameters
NameTypeDescription
$qstring

String to check

$oarray

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
TypeDescription
booleanIf `true` - correct
Documentation was generated by phpDocumentor v2.9.0.