Class SqueakyMindsPhpHelper
This class provides helper methods I have developed or acquired over the years.
| package | SqueakyMindsPhpHelper |
|---|
array_first(array $array_val) : array
| method | |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
array
\InvalidArgumentException |
Not array data. |
|---|
arrayarray_last(array $array_val) : array
| method | Return the last array member. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
arrayArray data.
\InvalidArgumentException |
Not array data. |
|---|
arraybr2nl(string $string) : string
| method | Convert BR tags to PHP_EOL. |
|---|---|
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringThe string to convert
stringThe converted stringdump_simple_array(mixed $array, string $title = "") : string
| method | HTML Dump of string/array/etc. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
mixedData to dump.
stringTable title.
stringduration(integer $secs) : string
| method | Return duration from seconds. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
integerSeconds value.
stringescape($inp) : string
| method | Escape a string just like mysql_escape_string which is now depreciated. |
|---|---|
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringgetvar($name, boolean $isint = false) : integer | mixed | string
| method | Prevent undefined get variables |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
boolean
integermixedstring
getvar_default(string $field_name, mixed $default_val = "") : mixed
| method | Return getvar with a default is blank. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
string$_GET variable key name.
mixedThe default value returned in the event the $_GET variable is empty or does not exist.
mixedjson_indent(string $json) : string
| method | |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringThe original JSON string to process.
stringIndented version of the original JSON string.left(string $str, integer $howManyCharsFromLeft) : string
| method | Return characters from the left. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringString to truncate.
integerNumber of characters to the left of the string.
stringlinkify($value) : string
| method | ) |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringmid(string $str, integer $start, integer $howManyChars = 0) : string
| method | Return x many characters from the starting point |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringString to truncate.
integerWhere to start from the left of the string.
integerNumber of characters to return.
stringmulti_stripslashes(callable $arr)
| method | Return array stripslasshes recursive. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
callableInput array.
numberToRoman(integer $num) : string
| method | Return roman numeral. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
integerNumber to transform.
stringobject2array(object $object) : array
| method | Return an array from an object. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
objectObject to transform.
arraypostvar($name, boolean $isint = false) : integer | mixed | string
| method | Prevent undefined post variables |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
boolean
integermixedstring
postvar_default(string $field_name, mixed $default_val = "") : mixed
| method | Return postvar with a default is blank. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
string$_POST variable key name.
mixedThe default value returned in the event the $_POST variable is empty or does not exist.
mixedrequested_url() : string
| method | |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringright(string $str, integer $howManyCharsFromRight) : string
| method | Return characters from the right. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringString to truncate.
integerNumber of characters to the right of the string.
stringsend_no_cache_header()
| method | |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
servervar($name, boolean $isint = false) : array | integer | string
| method | Prevent undefined servervar variables |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
boolean
arrayintegerstring
sessionvar(string $name, boolean $isint = false) : mixed
| method | Prevent undefined session variables |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
string$_SESSION variable key
booleanResponse if an integer
mixedsetsessionvar(string $name, boolean $value)
| method | |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
string$_SESSION variable key
boolean$_SESSION variable value
stringTruncate(string $string, integer $limit, string $break= ".", string $pad= "...") : string
| method | Truncate a string. |
|---|---|
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringThe string to truncate.
integerString length max.
string(optional) Break point, defauls to period.
string(optional) String to append to the truncated string.
stringTruncated string.truncate(integer $num, integer $digits = 0) : integer
| method | Return truncated number. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
integerNumber to truncate.
integerNumber of digits to truncate.
integeruuid() : string
| method | Return a 32 bit unique ID |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
string32 character unique ID.xml2array(string $xmlstring) : array
| method | Return an array from xml string. |
|---|---|
| access | public |
| author | Brian Tafoya |
| copyright | Copyright 2001 - 2017, Brian Tafoya. |
| version | 1.0 |
stringXML to process.
array