imstillatwork
IS-IT--Management
I'm working with a database that is used by a PHP app. In several fields, PHP arrays are stored in a format sort of like what WDDX does, but not xml based. I need to convert that the something I can work with in CFML.
Here is an example:
You can see nested arrays, strings integers (a,s,i) and the number is the length of the value, or number of elements in the array. reading down the list of elements give you name,value,name,value,name,value as far as the application is concerned.
example:
Has anyone ever written or seen a UDF that will convert this sort of thing into a CFML array (nested arrays)
I am simply not good enough with regex to start breaking it down. I might have to learn though.
I know a few things:
1) It will have to be recursive
Kevin
Phase 1: Read the CFML Reference
Phase 2: ???
Phase 3: Profit!
Here is an example:
Code:
a:6:{
s:4:"name";
s:12:"clinic_name1";
s:5:"title";
s:19:"Primary Clinic Name";
s:4:"type";
s:4:"text";
s:11:"description";
s:0:"";
s:13:"validate_func";
s:0:"";
s:17:"additional_fields";
a:9:{
s:3:"sql";
i:1;
s:8:"sql_type";
s:12:"VARCHAR(255)";
s:4:"size";
s:2:"20";
s:7:"default";
s:0:"";
s:7:"options";
a:0:{}s:4:"cols";
s:2:"20";
s:4:"rows";
s:1:"5";
s:14:"display_signup";
s:1:"1";
s:15:"display_profile";
s:1:"1";
}
You can see nested arrays, strings integers (a,s,i) and the number is the length of the value, or number of elements in the array. reading down the list of elements give you name,value,name,value,name,value as far as the application is concerned.
example:
Code:
a:9:{ (array)
s:3:"sql"; (name)
i:1; (value)
s:8:"sql_type"; (name)
s:12:"VARCHAR(255)"; (value)
Has anyone ever written or seen a UDF that will convert this sort of thing into a CFML array (nested arrays)
I am simply not good enough with regex to start breaking it down. I might have to learn though.
I know a few things:
1) It will have to be recursive
Kevin
Phase 1: Read the CFML Reference
Phase 2: ???
Phase 3: Profit!