I have a string like "create:this:assoc:array"
I want to create from this string
$array["create"]["this"]["assoc"]["array"] = "data"
what i have is
static public function add($data_path, $data)
{
if(!empty($data) && !empty($data_path)) {
$keys = explode(":", $data_path);
$looper = array();
$length = count($keys) - 1;
for ($i=0; $i <= $length ; $i++)
{
if($i == $length)
@$looper[$keys[$i]] = $data;
else
{
@$looper[$keys[$i]] = $keys[$i+1];
}
}// end for loop
echo '<pre>';
print_r($looper);
echo '</pre>';
}
}