note 87857 deleted from function.serialize by danbrown
| From: | danbrown@php.net | Date: | Sat, 27 Dec 2008 17:45:34 +0000 |
| Subject: | note 87857 deleted from function.serialize by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148580@lists.php.net to get a copy of this message | ||
Note Submitter: Luis Rodriguez-R
----
@Marek Soldt
"ceil(strlen($data) / $ko)" can be precomputed and stored on a variable, so PHP
doesn't have to evaluate the expression once and again:
<?php
// string in $data
$ko = 4096;
$data2 = array();
$limit = ceil(strlen($data) / $ko);
for($i=0;$i<$limit;$i++) {
$data2[] = substr($data,($i * $ko),(($i+1) * $ko));
}
// prepared array in $data2
?>
Thanks for the code.