mirror of
https://github.com/shuchkin/simplexlsxgen.git
synced 2023-08-10 21:12:59 +03:00
Replace array_search to optimize large arrays
This commit is contained in:
parent
5a4c04025a
commit
291b508143
@ -162,6 +162,7 @@ class SimpleXLSXGen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$SI = [];
|
$SI = [];
|
||||||
|
$SI_KEYS = [];
|
||||||
$COLS = [];
|
$COLS = [];
|
||||||
$ROWS = [];
|
$ROWS = [];
|
||||||
if ( count($this->rows) ) {
|
if ( count($this->rows) ) {
|
||||||
@ -212,10 +213,15 @@ class SimpleXLSXGen {
|
|||||||
} else {
|
} else {
|
||||||
$ct = 's'; // shared string
|
$ct = 's'; // shared string
|
||||||
$v = str_replace(['&','<','>'],['&','<','>'], $v);
|
$v = str_replace(['&','<','>'],['&','<','>'], $v);
|
||||||
$cv = array_search( $v, $SI, true );
|
$cv = false;
|
||||||
|
if ( isset($SI_KEYS[$v]) ) {
|
||||||
|
$cv = $SI_KEYS[$v];
|
||||||
|
}
|
||||||
|
|
||||||
if ( $cv === false ) {
|
if ( $cv === false ) {
|
||||||
$SI[] = $v;
|
$SI[] = $v;
|
||||||
$cv = count( $SI ) - 1;
|
$cv = count( $SI ) - 1;
|
||||||
|
$SI_KEYS[$v] = $cv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( is_int( $v ) || is_float( $v ) ) {
|
} elseif ( is_int( $v ) || is_float( $v ) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user