[php-src] Issue #10516: pack for an array of values
| From: | GajowyJ | Date: | Mon, 06 Feb 2023 10:01:15 +0000 |
| Subject: | [php-src] Issue #10516: pack for an array of values | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243654@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10516
Author: GajowyJ
### Description
pack() function takes as arguments: format and then list of values.
pack(string $format, mixed ...$values): string
Quite ofthen an array of data need to be packed and there is no function to do it efficiently. Let
say we have a table with a number (milions or more) of double values. A code like this needs to be
used:
```
$data='';
foreach( $array as $double )
$data .= pack('d',$double);
```
It would be usefull if one could execute instead:
$data = vpack('d*',$array);