Conditions | 5 |
Paths | 12 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | function uint64($i, bool $endianness = null){ |
||
34 | |||
35 | if($endianness === true){ // big-endian |
||
36 | $f = 'J'; |
||
37 | } |
||
38 | elseif($endianness === false){ // little-endian |
||
39 | $f = 'P'; |
||
40 | } |
||
41 | else{ // machine byte order |
||
42 | $f = 'Q'; |
||
43 | } |
||
44 | |||
45 | $i = is_int($i) ? pack($f, $i) : unpack($f, $i); |
||
46 | |||
47 | return is_array($i) ? $i[1] : $i; |
||
48 | } |
||
66 |