Download the PHP package openlss/func-mda without Composer
On this page you can find all versions of the php package openlss/func-mda. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download openlss/func-mda
More information about openlss/func-mda
Files in openlss/func-mda
Package func-mda
Short Description MDA (Multi Dimensional Array) access helpers for PHP
License LGPL-3.0+
Homepage http://openlss.org
Informations about the package func-mda
openlss/func-mda
MDA (Multi Dimensional Array) access helpers for PHP
Usage
Reference
Keys (Paths)
MDA keys are used in every function. Sometimes they are referred to as "paths" or "path"
- Dotted notation
- Notation: mda_get($arr,'index1.index2.index3.index4.0')
- Array: $arr['index1']['index2']['index3']['index4'][0]
- Argument notation
- Notation: mda_get($arr,'index1','index2','index3','index4','0')
- Array: $arr['index1']['index2']['index3']['index4'][0]
- Mixed Notation
- Notation: mda_get($arr,'index1.index2.index3','index4','0')
- Array: $arr['index1']['index2']['index3']['index4'][0]
(mixed) mda_get(&$arr,$path=null)
Returns the key from $arr
(mixed) mda_set(&$arr,$path=null)
All of the set functions take the value as the last argument Example
(mixed) mda_add(&$arr,$path=null)
Same as set except it adds the value as an anonymous index
(bool) mda_del(&$arr,$path=null)
Delete a path from array
(mixed) mda_del_value(&$arr,$path=null)
This will delete all values from a path
(bool) mda_exists_value(&$arr,$path=null)
This will check if a value exists in a path, same as mda_del_value()
(bool) mda_exists(&$arr,$path)
Checks if a path exists
(array) mda_flatten(&$arr,$keyname)
NOTE: this does not take a path it takes a keyname
- use mda_get to find the lowest possible path and pass that
- to this functions eg: $arr = mda_flatten(mda_get($arr,'path1.path2.path3'),'row_id);
(string) implodei($join,$arr=array())
Same prototype as PHPs implode with the enhanced functionality that it will take $join as an array If $join is a string it will pass directly to PHPs implode which is faster Example
NOTE: the last member of the array gets repeated
(mixed) mda_shift($arr)
NOTE: THIS WILL NOT INCREASE THE ARRAYS POINTER (DOES NOT FUNCTION LIKE ARRAY_SHIFT) Use this to shift anonymous arrays only it does not reference the original array Otherwise its the same as PHPs array_shift()
(array) mda_merge($arr,$arr[,$arr...])
Will recursively merge arrays similar to array_merge DOES NOT function like array_merge_recursive which is wrong