; sample03 : The example 3 of the preference ; ; Description : Converting by the function ; ; current internal encoding ; Comments start with ';', as in php.ini. ; The line sandwiching in "[]" is a section. ; Data Section ; with the Section Name [data 01:First] 1 = Star Wars 2 = Star Trek 99 = other [data 02:Second] 1 = Mickey Mouse 2 = Tom and Jelly 99 = other ; Function Section ; New Key = "Function Source" ; Function Param is "$data" only. ; $data = array ; $data['_SECTION'] : Section Name ; $data['_KEY'] : Data Key in a Line. ; $data['_VALUE'] : Data Value in a Line. [function] _temp = "return explode(':',$data['_SECTION'],2);" category = "return $data['_temp'][0];" cat_nm = "return $data['_temp'][1];" id = "return sprintf('%s%02d',$data['category'],$data['_KEY']);" name = "return $data['_VALUE'];" ; Other Section [title] category = category id cat_nm = category name id = ID name = title name ; Result of wp_load_inifile('sample03.ini'): ; return array( ; 'data' => array( ; 0 => array( ; '_SECTION' => '01:First', ; '_KEY' => 1, ; '_VALUE' => 'Star Wars', ; '_temp' => array('01','First'), ; 'category' => '01', ; 'cat_nm' => 'First', ; 'id' => '0101', ; 'name' => 'Star Wars', ; ), ; : ; : ; : ; 6 => array( ; '_SECTION' => '02:Second', ; '_KEY' => 99, ; '_VALUE' => 'other', ; '_temp' => array('02','Second'), ; 'category' => '02', ; 'cat_nm' => 'Second', ; 'id' => '0299', ; 'name' => 'other', ; ) ; ), ; 'option' => array( ; 'title' => array( ; 'category' => 'category id', ; 'cat_nm' => 'category name', ; 'id' => 'ID', ; 'name' => 'title name' ; ) ; ) ; );