tasoft / php-secure-int64-extension
Installs: 4
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Language:C
Requires
- php: >=7.3
This package is auto-updated.
Last update: 2024-11-29 06:41:43 UTC
README
I've created this package to handle UUIDs from MFRC511 module. It uses five byte ids which can not be represented by a 32bit system. (as Raspberry Pi is 32bit.)
Installation
$ cd ~
$ git clone https://github.com/tasoftch/php-secure-int64-extension.git
$ cd php-secure-int64-extension
$ phpize
$ ./configure --enable-secure-int64
$ make
$ sudo make install
This compiles the source on your machine.
Next find the php.ini file
$ php --ini
Will list scanned ini files.
Add the following line to that php.ini file:
extension=secure_int64
<?php var_dump( extension_loaded('secure_int64') ); // Should be true
Usage
The extension adds the following functions to the global scope:
sint64_array_to_string
Converts an array of maximal 8 bytes into a 64bit signed integer representation as string.uint64_array_to_string
Converts an array of maximal 8 bytes into a 64bit unsigned integer representation as string.sint64_string_to_array
Interprets a string as signed 64bit integer value and returns it as array, MSB first.uint64_string_to_array
Interprets a string as unsigned 64bit integer value and returns it as array, MSB first.
Example
<?php echo sint64_array_to_string([1]); // 1 echo sint64_array_to_string([1, 4]); // 260 echo sint64_array_to_string([0xFF, 0xFF]); // 65535 echo sint64_array_to_string([0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); // 9223372036854775807 echo sint64_array_to_string([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); // -1 echo uint64_array_to_string([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); // 18446744073709551615 ?>