ddrv / extra-pack
Extras for pack() and unpack() functions
0.9.6-beta
2018-02-15 18:25 UTC
Requires
- php: >=5.0.0
Requires (Dev)
- phpunit/phpunit: >=4.8
This package is auto-updated.
Last update: 2024-10-24 03:14:57 UTC
README
ExtraPack
Extras for pack() and unpack() functions.
Install
composer require ddrv/extra-pack
<?php require ('vendor/autoload.php');
Usage
<?php $data = array( 'key1' => 'string', 'key2' => 5, 'key3' => .0001 ); $format = 'A6key1/Ckey2/t4key3'; $binary = \Ddrv\Extra\Pack::pack($format, $data); $result = \Ddrv\Extra\Pack::unpack($format, $binary); print_r($result);
Array
(
[key1] => string
[key2] => 5
[key3] => .0001
)
Format
character[+number]+key[+:added]
Elements are separated by a slash
Examples:
Format characters
Currently implemented formats are: