Array Helper
The cluster aide gives a few capacities to disentangle progressively complex utilizations of exhibits. It isn't planned to copy any of the current usefulness that PHP gives - except if it is to boundlessly disentangle their use.
- Loading this Helper
- Available Functions
Loading this Helper
This aide is stacked utilizing the accompanying code:
helper('array');
Available Functions
The accompanying capacities are accessible:
dot_array_search(string $search, array $values)
Parameters:
$search (string) – The speck documentation string depicting how to look through the exhibit
$values (array) – The cluster to look
Returns:
The worth found inside the exhibit, or invalid
Return type:
mixed
This strategy permits you to utilize spot documentation to look through an exhibit for a particular key, and permits the utilization of a the '*' special case. Given the accompanying exhibit:
$data = [
'foo' => [
'buzz' => [
'fizz' => 11
],
'bar' => [
'baz' => 23
]
]
]
We can find the estimation of 'bubble' by utilizing the inquiry string "foo.buzz.fizz". Similarly, the estimation of baz can be found with "foo.bar.baz":
// Returns: 11
$fizz = dot_array_search('foo.buzz.fizz', $data);
// Returns: 23
$baz = dot_array_search('foo.bar.baz', $data);
You can utilize the reference mark as a special case to supplant any of the sections. At the point when discovered, it will look through the entirety of the youngster hubs until it discovers it. This is convenient on the off chance that you don't have the foggiest idea about the qualities, or if your qualities have a numeric record:
// Returns: 23
$baz = dot_array_search('foo.*.baz', $data);