PHP code example of olifanton / utils

1. Go to this page and download the library: Download olifanton/utils library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

olifanton / utils example snippets


 declare(strict_types=1);

se Olifanton\Utils\Bytes;
use Olifanton\Utils\Crypto;
use Olifanton\Utils\Units;

// Now you can use Olifanton utils classes


/**
 * @param string | \Olifanton\Utils\Address $anyForm
 */
public function __construct(string | Address $anyForm)

/**
 * @param bool|null $isUserFriendly User-friendly flag
 * @param bool|null $isUrlSafe URL safe encoded flag
 * @param bool|null $isBounceable Bounceable address flag
 * @param bool|null $isTestOnly Testnet Only flag
 */
public function toString(?bool $isUserFriendly = null,
                         ?bool $isUrlSafe = null,
                         ?bool $isBounceable = null,
                         ?bool $isTestOnly = null): string

$a = \Olifanton\Utils\Bytes::stringToBytes('a');
$a[0] === 97; // True, because the ASCII code of `a` is 97 in decimal

$a = \Olifanton\Utils\Bytes::hexStringToBytes('0a');
$a[0] === 10; // True

$s = \Olifanton\Utils\Bytes::bytesToHexString(new \ajf\TypedArrays\Uint8Array([10]));
$s === '0a'; // True