I want to use a function to render an arraykey so I can use it later. I don't even know if something like this is possible. The function I have for now looks like this
function array_key_render($key){
$result = explode('.', $key);
$num = count($result);
for($i=0;$i<$num;$i++){
$array_key .= [$result[$i]];
}
return $array_key;
}
The mainidea is that I can input i.e. PRODUCT.PRIZE and then I would like to get back something like
['PRODUCT']['PRIZE']
UPDATE: i.e. when I have an array like that with numeric keys :
Array
(
[PRODUCT] => Array
(
[0] => Array
(
[NAME] => jeans
[TITLE] => Blop
[PRIZE] => Array
(
[NEW] => 13.23€
[0] => 24,40€
)
)
[1] => Array
(
[NAME] => Pullover
[TITLE] => OMG
[PRIZE] => Array
(
[0] => 13.23€
[NEW] => 24,40€
)
)
)
)
When I would go for PRODUCT.PRIZE it would return false with my choosen answer. How could I make some kind of wildcard for all numeric keys to make them match? Something like PRODUCT.*.PRIZE
The whole thing is for a little templateengine. If you have some pointers or hints for me, would be great.