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. |
---|
array
array_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 |
array
Array data.
\InvalidArgumentException |
Not array data. |
---|
array
br2nl(string $string) : string
method | Convert BR tags to PHP_EOL. |
---|---|
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
string
The string to convert
string
The 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 |
mixed
Data to dump.
string
Table title.
string
duration(integer $secs) : string
method | Return duration from seconds. |
---|---|
access | public |
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
integer
Seconds value.
string
escape($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 |
string
getvar($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
integer
mixed
string
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.
mixed
The default value returned in the event the $_GET variable is empty or does not exist.
mixed
json_indent(string $json) : string
method | |
---|---|
access | public |
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
string
The original JSON string to process.
string
Indented 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 |
string
String to truncate.
integer
Number of characters to the left of the string.
string
linkify($value) : string
method | ) |
---|---|
access | public |
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
string
mid(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 |
string
String to truncate.
integer
Where to start from the left of the string.
integer
Number of characters to return.
string
multi_stripslashes(callable $arr)
method | Return array stripslasshes recursive. |
---|---|
access | public |
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
callable
Input array.
numberToRoman(integer $num) : string
method | Return roman numeral. |
---|---|
access | public |
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
integer
Number to transform.
string
object2array(object $object) : array
method | Return an array from an object. |
---|---|
access | public |
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
object
Object to transform.
array
postvar($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
integer
mixed
string
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.
mixed
The default value returned in the event the $_POST variable is empty or does not exist.
mixed
requested_url() : string
method | |
---|---|
access | public |
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
string
right(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 |
string
String to truncate.
integer
Number of characters to the right of the string.
string
send_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
array
integer
string
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
boolean
Response if an integer
mixed
setsessionvar(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 |
string
The string to truncate.
integer
String length max.
string
(optional) Break point, defauls to period.
string
(optional) String to append to the truncated string.
string
Truncated 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 |
integer
Number to truncate.
integer
Number of digits to truncate.
integer
uuid() : string
method | Return a 32 bit unique ID |
---|---|
access | public |
author | Brian Tafoya |
copyright | Copyright 2001 - 2017, Brian Tafoya. |
version | 1.0 |
string
32 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 |
string
XML to process.
array