Given a string that contains values separated by dots:
property.entry.item What is the best way to convert that to a key for an associative array?
$result['imported_data']['property']['entry']['item'] The string may be of any length, with any number of dots and contain an value:
people.arizona.phoenix.smith I've tried the following without success:
//found a dot, means we are expecting output from a previous function if( preg_match('[.]',$value)) { //check for previous function output if(!is_null($result['import'])) { $chained_result_array = explode('.',$value); //make sure we have an array to work with if(is_array($chained_result_array)) { $array_key = ''; foreach($chained_result_array as $key) { $array_key .= '[\''.$key.'\']'; } } die(print_r(${result.'[\'import\']'.$array_key})); } } I was thinking I could convert the string to a variable variable, but I get an array to string conversion error.