How can I create an array using pair of values in PHP? -


i have list of status , subtsatuses need "translate"/convert new one, in example below:

old status        old substatus     new status          new substatus ----------------------------------------------------------------------- 4-defer          code freeze           11          code/hardware bug (response/resolution), dev priority = 4, confirmed = ‘y’ 4-defer          future project        11          code/hardware bug (response/resolution), dev priority = 4, confirmed = ‘y’ 4-defer          no plan fix        11          code/hardware bug (response/resolution), dev priority = 4, confirmed = ‘y’ 4-defer      no resource available     11          code/hardware bug (response/resolution), dev priority = 4, confirmed = ‘y’ ... 11-closed           duplicate          96          closed, duplicate bug 11-closed        not reproducible      91          closed, not reproduce 11-closed         not defect         92          closed, not bug 

is there way can declare array in pairs (via multidimension array), or combined classes, in order make conversion?

something    (11, "duplicate") => (96, "closed, duplicate bug") 

any appreciated.

thanks in advance!

assuming have text file , can read each line in turn following. noticed values separated 2 or more spaces. way of identifying delimeter.

so example working on 1 of lines assume looping through each line , doing this.

// here's 1 line, pushed $str $str    = "4-defer          code freeze   11    code/hardware bug etc";  // use multiple spaces delimeter , replace them #^# (a single delimeter) $str    = preg_replace("/[ ]{2,99}/i","#^#",$str);  // explode on delimeter $str    = explode("#^#",$str);  // have array containing each column data // can build new array directly referring columns print "<pre>"; print_r($str); print "</pre>"; 

hope helps, or sparks ideas!! ps - realise large spaces single tabs (\t) i'm going guess spaces sakes of example :)


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -