Answer the question
In order to leave comments, you need to log in
How to compress a large associative array and then iterate over it. PHP?
There is such a large array, it can be even larger.
$array = array(
"1.5 сп" => [
'color' => [
'Зеленый' => 'green',
'Черный' => 'black',
],
'price' => '250'
],
"2 сп" => [
'color' => [
'Зеленый' => 'green',
'Черный' => 'black',
],
'price' => '250'
],
"3 сп" => [
'color' => [
'Зеленый' => 'green',
'Черный' => 'black',
],
'price' => '350'
],
"4 сп" => [
'color' => [
'Зеленый' => 'green',
'Черный' => 'black',
],
'price' => '150'
],
);
$string = serialize($array);
a:4:{s:8:"1.5 сп";a:2:{s:5:"color";a:2:{s:14:"Зеленый";s:5:"green";s:12:"Черный";s:5:"black";}s:5:"price";s:3:"250";}s:6:"2 сп";a:2:{s:5:"color";a:2:{s:14:"Зеленый";s:5:"green";s:12:"Черный";s:5:"black";}s:5:"price";s:3:"250";}s:6:"3 сп";a:2:{s:5:"color";a:2:{s:14:"Зеленый";s:5:"green";s:12:"Черный";s:5:"black";}s:5:"price";s:3:"350";}s:6:"4 сп";a:2:{s:5:"color";a:2:{s:14:"Зеленый";s:5:"green";s:12:"Черный";s:5:"black";}s:5:"price";s:3:"150";}}
Answer the question
In order to leave comments, you need to log in
php.net/manual/ru/function.gzcompress.php
ruseller.com/lessons.php?id=699&rub=37
Serialization of a large array of numbers with compression
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question