<?php function flatCall($data_arr, $data_arr_call){ $current = $data_arr; foreach($data_arr_call as $key){ $current = $current[$key]; } return $current; } $MAP = array("profile" => array("setting" => array("test" => array("idknow" => "someValue")))); $urlString = "www.example.com/profile/setting/test/idknow"; $URL = explode("/", $urlString); //split URL string into an array array_shift($URL); //remove first element $result = flatCall($MAP, $URL); echo $result;
You have javascript disabled. You will not be able to edit any code.