ampere.teleinfo/code/trameAnalyse.php

23 lines
557 B
PHP
Raw Normal View History

2023-12-05 01:07:36 +01:00
<?php
$trame = ",ADCO 020122037669 =,,OPTARIF HC.. <,,ISOUSC 45 ?,,HCHC 140779009 +,,HCHP 097287521 <,,PTEC HP.. ,,IINST 011 Y,,IMAX 045 H,,PAPP 02470 .,,HHPHC C .,,TIMESTAMP 1575210073";
function explode_edfTrame($trame) {
$edf_proprietes = array();
foreach(explode(",", $trame) as $propriete) {
// on ignore les lignes vides
if (strlen($propriete)>0) {
$prop = explode(" ", $propriete);
if (count($prop) > 1) {
$edf_proprietes[] = array($prop[0], $prop[1]);
}
}
}
return $edf_proprietes;
}
print_r(explode_edfTrame($trame));