Class Utils
Methods summary
public static
string
|
#
dumpVar( mixed $var, boolean $echo = true )
Output a dump of a variable
Output a dump of a variable
Parameters
- $var
- variable to dump
- $echo
- true to echo dump, false to return dump as string
Returns
string
|
public static
string
|
#
dumpFile( mixed $file, boolean $echo = true )
Output a dump of a file
Parameters
- $file
- file to dump
- $echo
- true to echo dump, false to return dump as string
Returns
string
|
public static
array
|
#
arrayRecursiveDiff( array $aArray1, array $aArray2 )
Support for recursive array_diff
Support for recursive array_diff
Compares first array against the second and returns the difference - that is
the values in the first, but not in the second array
Parameters
- $aArray1
- first array
- $aArray2
- second array
Returns
array
|
public static
array
|
#
arrayRecursiveMerge( array $data, mixed $merge )
This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive .
The difference between this method and the built-in ones, is that if an array key contains another array, then
Utils::arrayRecursiveMerge() will behave in a recursive fashion (unlike array_merge ). But it
will not act recursively for keys that contain scalar values (unlike array_merge_recursive ).
This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive .
The difference between this method and the built-in ones, is that if an array key contains another array, then
Utils::arrayRecursiveMerge() will behave in a recursive fashion (unlike array_merge ). But it
will not act recursively for keys that contain scalar values (unlike array_merge_recursive ).
Note: This function will work with an unlimited amount of arguments and typecasts non-array parameters
into arrays.
Parameters
- $data
- Array to be merged
- $merge
- Array to merge with. The argument and all trailing arguments will be array cast when merged
Returns
array Merged array
Link
|