1
0
mirror of https://github.com/danog/PHPStruct.git synced 2024-11-30 04:19:08 +01:00
PHPStruct/example.php

19 lines
959 B
PHP
Raw Normal View History

2016-07-04 01:43:23 +02:00
<?php
2016-07-06 14:24:07 +02:00
//require('vendor/autoload.php');
2016-07-13 20:00:38 +02:00
require 'lib/danog/PHP/Struct.php';
2016-07-09 19:43:34 +02:00
//var_dump(["nv", 61, 61, false, 333, 444, 232423, 234342, 243342423424, 234234234234, 234234234234, 234234234234, 34434, 344434, 2.2343, 3.03424, "dd"]);
2016-07-13 20:00:38 +02:00
var_dump(\danog\PHP\Struct::unpack('2cxbxBx?xhxHxixIxlxLxqxQxnxNxfxdx2sx5pP',
\danog\PHP\Struct::pack('2cxbxBx?xhxHxixIxlxLxqxQxnxNxfxdx2sx5pP',
2016-07-23 21:37:31 +02:00
'n', 'v', 100, 100, false, 333, 444, 232423, 234342, 999999999999, 999999999999, 888888888888,
2016-07-23 00:15:51 +02:00
888888888888, 34434, 344434, 2.2343,
2016-07-13 20:00:38 +02:00
3.03424, 'df', 'asdfghjkl', 1283912
2016-07-08 22:57:46 +02:00
)
));
2016-07-23 21:37:31 +02:00
var_dump(bin2hex(\danog\PHP\Struct::pack('=i',
999999999999)));
2016-07-11 12:33:56 +02:00
// 2c x b x B x ? x h x H x i x I x l x L x q x Q x n x N x f x d x 2s x
//print(struct.unpack("2cxbxBx?xhxHxixIxlxLxqxQxnxNxfxdx2sx", struct.pack("2cxbxBx?xhxHxixIxlxLxqxQxnxNxfxdx2sx", "nv", 100, 100, False, 333, 444, 232423, 234342, 234234234234, 234234234234, 234234234234, 234234234234, 34434, 344434, 2.2343, 3.03424, "dd")));