0

since hours I am on this problem:

// b) replace xls operation with fitting vars: E12 > var2233
preg_match_all('/[A-Z]{1,2}\d+/', $rowoperation["formulaxls"], $matches);
  $output = $rowoperation["formulaxls"];
  foreach ($matches[0] as $match) {
    $result2 = $db->query("SELECT varid FROM variablen WHERE varimportedindex = '".$match."' AND projectid = $pid");
    $rowoperation = $result2->fetch_assoc();
    $output = preg_replace("#".$match."#", "var".$rowoperation['varid']."", $output);
    $output = preg_replace('#\,#', ";", $output);
    #$output = str_replace($match, "var".$rowoperation['varid']."", $output);
    #$output = str_replace(',', ";", $output);
  }

Output of matches seem to be ok. But the replacement is not. I always got strange replacements like "Avar30031=var3424 var3612=var3424 var3613=var3424 Avar30051=var3424". So i dont't understand, why it replaces "Avar" in between. The Numbers are then also not right.

Is it possible, that it makes problem with a Excel cellindex A10 because of the "0"?

Thank you all experts...

Regards Olaf

Olaf K.
  • 39
  • 10

0 Answers0