Let's say, I have an Array Object:
stdClass Object
(
[uri] => sites/all/themes/bootstrap/templates/test-example.tpl.php
[filename] => test-example.tpl.php
[name] => test-example.tpl
)
Is there any way to map [uri] to [filename] ?
Example:
Array(
[sites/all/themes/bootstrap/templates/test-example.tpl.php] = [test-example.tpl.php]
)
Let's assume that your object is named $obj
:
$map = array( $obj->uri => $obj->filename );
var_dump( $map );
If you need to iterate through many elements, you can use foreach
, but the logic is the same at all.