Home  >  Q&A  >  body text

Deprecated: Implicit conversion from float xx.xxxx to int loses precision excel_reader2.php line 922

Operating system: Windows 11 PHP version 8.1.6

wrong information: DEPRECATED: Implicit conversion from float 65.03846153846153 to int loses precision C:xampphtdocssatiimportexcel_reader2.php line 922

public function __construct($file='',$store_extended_info=true,$outputEncoding='') {

  $this->_ole = new OLERead();
  $this->setUTFEncoder('iconv');
  if ($outputEncoding != '') { 
    $this->setOutputEncoding($outputEncoding);
  }
  for ($i=1; $i<245; $i++) {
    $name = strtolower(( (($i-1)/26>=1)?chr(($i-1)/26+64):'') . chr(($i-1)%26+65));  //line 922
    $this->colnames[$name] = $i;
    $this->colindexes[$i] = $name;
  }
  $this->store_extended_info = $store_extended_info;
  if ($file!="") {
    $this->read($file);
  }
}

Does anyone have a solution to this problem?

P粉654894952P粉654894952263 days ago538

reply all(1)I'll reply

  • P粉563831052

    P粉5638310522024-01-05 10:07:56

    Yes, It has been deprecated

    You should convert the result of the calculation to an integer when passing to chr():

    strtolower(
        (
            ($i-1)/26>=1
                ? chr((int) ($i-1)/26+64)
                : ''
        )
        . chr((int) ($i-1)%26+65)
    )
    

    reply
    0
  • Cancelreply