Methods summary
private
|
|
public static
array
|
#
flattenArray( array $aArray )
Flatten a multidimensional array (keys are ignored).
Flatten a multidimensional array (keys are ignored).
Parameters
Returns
array a one dimensional array.
See
|
public static
string
|
#
utf8Encode( string $str )
Returns the UTF-8 translation of the specified string, only if not already in
UTF-8.
Returns the UTF-8 translation of the specified string, only if not already in
UTF-8.
Parameters
Returns
string the UTF-8 translation of the specified string, only if not already in UTF-8.
|
public static
array
|
#
exec( string $sCmd, string $sOutputPath = '', string $sErrorPath = '', boolean $bAppend = false )
Executes the given shell command and returns an array filled with every line
of output from the command. Trailing whitespace, such as \n, is not included in
this array. On shell error (exit code <> 0), throws a \RuntimeException
with error message..
Executes the given shell command and returns an array filled with every line
of output from the command. Trailing whitespace, such as \n, is not included in
this array. On shell error (exit code <> 0), throws a \RuntimeException
with error message..
Parameters
- $sCmd
string $sCmd shell command
- $sOutputPath
string $sOutputPath optional redirection of standard output
- $sErrorPath
string $sErrorPath optional redirection of standard error
- $bAppend
boolean $bAppend true to append to specified files
Returns
array array filled with every line of output from the command
Throws
RuntimeException if shell error
|
public static
string
|
#
stripBashColors( string $sMsg )
Remove all Bash color sequences from the specified string.
Remove all Bash color sequences from the specified string.
Parameters
Returns
string specified string without any Bash color sequence.
|
public static
string
|
#
round( float $fValue, integer $iPrecision = 0 )
Rounds specified value with precision $iPrecision as native round() function,
but keep trailing zeros.
Rounds specified value with precision $iPrecision as native round() function,
but keep trailing zeros.
Parameters
- $fValue
float $fValue value to round
- $iPrecision
integer $iPrecision the optional number of decimal digits to round to (can also be
negative)
Returns
string
|
public static
string
|
#
ucwordWithDelimiters( string $sString, array $aDelimiters = array() )
Returns a string with the first character of each word in specified string
capitalized, if that character is alphabetic. Additionally, each character that
is immediately after one of $aDelimiters will be capitalized too.
Returns a string with the first character of each word in specified string
capitalized, if that character is alphabetic. Additionally, each character that
is immediately after one of $aDelimiters will be capitalized too.
Parameters
- $sString
string $sString
- $aDelimiters
array $aDelimiters
Returns
string
|
public static
array
|
#
intToMultiple( integer $iValue, boolean $bBinaryPrefix = false )
Returns specified value in the most appropriate unit, with that unit. If
$bBinaryPrefix is FALSE then use SI units (i.e. k, M, G, T), else use IED units
(i.e. Ki, Mi, Gi, Ti).
Returns specified value in the most appropriate unit, with that unit. If
$bBinaryPrefix is FALSE then use SI units (i.e. k, M, G, T), else use IED units
(i.e. Ki, Mi, Gi, Ti).
Parameters
- $iValue
integer $iValue
- $bBinaryPrefix
boolean $bBinaryPrefix
Returns
array a pair constituted by specified value in the most appropriate unit and that unit
See
|
public static
string
|
#
numberFormat( float $fNumber, string $sDecPoint = '.', string $sThousandsSep = ',', integer $iDecimals = null )
Format a number with grouped thousands. It is an extended version of
number_format() that allows do not specify $decimals.
Format a number with grouped thousands. It is an extended version of
number_format() that allows do not specify $decimals.
Parameters
- $fNumber
float $fNumber The number being formatted.
- $sDecPoint
string $sDecPoint Sets the separator for the decimal point.
- $sThousandsSep
string $sThousandsSep Sets the thousands separator. Only the first character of
$thousands_sep is used.
- $iDecimals
integer $iDecimals Sets the number of decimal points.
Returns
string A formatted version of $number.
|
public static
string
|
#
strPutCSV( array $aInput, string $sDelimiter = ',', string $sEnclosure = '"' )
Formats a line passed as a fields array as CSV and return it, without the
trailing newline. Inspiration: http://www.php.net/manual/en/function.str-getcsv.php#88773
Parameters
- $aInput
array $aInput
- $sDelimiter
string $sDelimiter
- $sEnclosure
string $sEnclosure
Returns
string specified array converted into CSV format string
|
public static
array
|
#
arrayMergeRecursiveDistinct( array $aArray1, array $aArray2 )
array_merge_recursive() does indeed merge arrays, but it converts values with
duplicate keys to arrays rather than overwriting the value in the first array
with the duplicate value in the second array, as array_merge does. I.e., with
array_merge_recursive(), this happens (documented behavior):
array_merge_recursive() does indeed merge arrays, but it converts values with
duplicate keys to arrays rather than overwriting the value in the first array
with the duplicate value in the second array, as array_merge does. I.e., with
array_merge_recursive(), this happens (documented behavior):
array_merge_recursive(array('key' => 'org value'), array('key' => 'new
value')); ⇒ array('key' => array('org value', 'new value'));
arrayMergeRecursiveDistinct() does not change the datatypes of the values in
the arrays. Matching keys' values in the second array overwrite those in the
first array, as is the case with array_merge, i.e.:
arrayMergeRecursiveDistinct(array('key' => 'org value'), array('key' =>
'new value')); ⇒ array('key' => array('new value'));
EVO on indexed arrays: Before: arrayMergeRecursiveDistinct(array('a', 'b'),
array('c')) ⇒ array('c', 'b') Now: ⇒ array('c')
Parameters
- $aArray1
array $aArray1
- $aArray2
array $aArray2
Returns
array An array of values resulted from strictly merging the arguments together.
Author
Daniel <daniel (at) danielsmedegaardbuus (dot) dk>
Gabriel Sobrinho <gabriel (dot) sobrinho (at) gmail (dot) com>
Geoffroy Aubry
See
|
public static
boolean
|
#
isAssociativeArray( array $aArray )
Returns TRUE iff the specified array is associative. If the specified array
is empty, then return FALSE.
|