Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/07/2021 in all areas

  1. A couple of points about your processing: 1 ) As your first heading is "lmk_key" and the second is "address1", it appears that the data actually starts halfway through element 89, and that somewhere along the way whatever split the headings from the data has become a space character 2 ) Exploding on "," isn't working as the address data itself contains a comma, thus splitting that data over two elements ... [89] => low-energy-fixed-light-count 1229391483952014103108154495749528 [90] => "142 [91] => Edgar Road" Better to use str_getcsv() which knows how to process ... , "142, Edgar Road", ... If I change that space in the middle of element 89 to a |, then $str = 'lmk-key,address1,address2,address3,postcode,building-reference-number,current-energy-rating,potential-energy-rating,current-energy-efficiency,potential-energy-efficiency,property-type,built-form,inspection-date,local-authority,constituency,county,lodgement-date,transaction-type,environment-impact-current,environment-impact-potential,energy-consumption-current,energy-consumption-potential,co2-emissions-current,co2-emiss-curr-per-floor-area,co2-emissions-potential,lighting-cost-current,lighting-cost-potential,heating-cost-current,heating-cost-potential,hot-water-cost-current,hot-water-cost-potential,total-floor-area,energy-tariff,mains-gas-flag,floor-level,flat-top-storey,flat-storey-count,main-heating-controls,multi-glaze-proportion,glazed-type,glazed-area,extension-count,number-habitable-rooms,number-heated-rooms,low-energy-lighting,number-open-fireplaces,hotwater-description,hot-water-energy-eff,hot-water-env-eff,floor-description,floor-energy-eff,floor-env-eff,windows-description,windows-energy-eff,windows-env-eff,walls-description,walls-energy-eff,walls-env-eff,secondheat-description,sheating-energy-eff,sheating-env-eff,roof-description,roof-energy-eff,roof-env-eff,mainheat-description,mainheat-energy-eff,mainheat-env-eff,mainheatcont-description,mainheatc-energy-eff,mainheatc-env-eff,lighting-description,lighting-energy-eff,lighting-env-eff,main-fuel,wind-turbine-count,heat-loss-corridor,unheated-corridor-length,floor-height,photo-supply,solar-water-heating-flag,mechanical-ventilation,address,local-authority-label,constituency-label,posttown,construction-age-band,lodgement-datetime,tenure,fixed-lighting-outlets-count,low-energy-fixed-light-count|1229391483952014103108154495749528,"142, Edgar Road",,,TW4 5QP,5844359278,D,C,61,73,Maisonette,End-Terrace,2014-10-30,E09000027,E14001005,Greater London Authority,2014-10-31,marketed sale,57,73,241,152,4,46,2.5,56,56,747,473,155,125,87,Single,Y,3rd,Y,,2104,100,double glazing installed during or after 2002,Normal,0,5,5,100,0,From main system,Good,Good,"Solid, no insulation (assumed)",N/A,N/A,Fully double glazed,Good,Good,"Cavity wall, as built, no insulation (assumed)",Poor,Poor,None,N/A,N/A,"Flat, limited insulation (assumed)",Very Poor,Very Poor,"Boiler and radiators, mains gas",Good,Good,Programmer and room thermostat,Average,Average,Low energy lighting in all fixed outlets,Very Good,Very Good,mains gas (not community),1,unheated corridor,5,,0,,natural,"142, Edgar Road",Richmond upon Thames,Twickenham,HOUNSLOW,England and Wales: 1967-1975,2014-10-31 08:15:44,owner-occupied,11,11'; $arr = []; foreach (explode('|', $str) as $line) { $arr[] = str_getcsv($line); } echo '<pre>' . print_r(array_combine($arr[0], $arr[1]), 1) . '</pre>'; outputting... Array ( [lmk-key] => 1229391483952014103108154495749528 [address1] => 142, Edgar Road [address2] => [address3] => [postcode] => TW4 5QP [building-reference-number] => 5844359278 [current-energy-rating] => D [potential-energy-rating] => C [current-energy-efficiency] => 61 [potential-energy-efficiency] => 73 [property-type] => Maisonette [built-form] => End-Terrace [inspection-date] => 2014-10-30 [local-authority] => E09000027 [constituency] => E14001005 [county] => Greater London Authority [lodgement-date] => 2014-10-31 . . . etc }
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.