I have to create a script parse a path and replace variables with existing array attribute. I have an multi-deminsional array like below:
$param = array(
'titles'=>array(
'[group1]'=>array(
array('name'=>'picture','title'=>'personel_image','target_folder'=>'tmp/contacts/{name=picture}[value]'),
array('name'=>'full_name','title'=>'Full Name'),
array('name'=>'melli_code','title'=>'id code','format'=>'number'),
)
)
)
As you can see there is an attribute call target_folder that user write as following format,'tmp/contacts/{format=number}[title]/{name=picture}[title]'.
I need a solution to parse a bold part of above path as an array like below.
$search_for = array(
'0'=>array(
'[array_column]'=>'format',
'[array_column_keyword']=>'number',
'[array_column_value']=>'title',
),
'1'=>array(
'[array_column]'=>'name',
'[array_column_keyword']=>'picture',
'[array_column_value']=>'title',
)
)
What is the best way to resolve the above problem?
Aucun commentaire:
Enregistrer un commentaire