PHP code example of forweban / dz2-lib

1. Go to this page and download the library: Download forweban/dz2-lib 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/ */

    

forweban / dz2-lib example snippets


public static function br($n = null)
    {
        for ($i = 0; $i <= $n; $i++) {
            echo "<pre>".PHP_EOL."</pre>";
        };
    }

Help::br();
Help::br(3);

class Math
{
    ...
    
    private const PI = '3.1415926535';

    /**
     * @param float $rad
     * @return float|null
     */
    public static function getSquareCircle(float $rad): ?float
    {
        return self::PI * $rad ^ 2;
    }
    
    ...
}

$radius = 2.5;
$square = Math::getSquareCircle($radius);

declare(strict_types=1);

src\Help;
use forweban\dz2library\src\FirstLastKeys;
use forweban\dz2library\src\SomeFunctions;
use forweban\dz2library\src\Math;

$array = [
    'a' => 'AAA',
    'b' => 'BBB',
    'c' => 'CCC',
    'd' => 'DDD',
];

$firstLast = new FirstLastKeys($array);

list($first, $last) = $firstLast->getFirstLastKeys();

echo 'First key of array is \'' . $first . '\'';
Help::br(1);
echo 'Last key of array is \'' . $last . '\'';
Help::br();
Help::see($array);
Help::hr();

$password = 'qwerty';
$hashArgon = SomeFunctions::hashArgon($password);
echo $hashArgon;

Help::br();
Help::hr();

$_GET['user'] = 'Vasya';
$name = SomeFunctions::getGetUser($_GET['user']);
echo $name;

Help::br();
Help::hr();

$radius = 2.5;
$square = Math::getSquareCircle($radius);
echo $square;


...

$array = [
    'a' => 'AAA',
    'b' => 'BBB',
    'c' => 'CCC',
    'd' => 'DDD',
];

$firstLast = new FirstLastKeys($array);

list($first, $last) = $firstLast->getFirstLastKeys();

// $first = 'a'
// $last = 'd'

$password = 'qwerty';
$hashArgon = SomeFunctions::hashArgon($password);

public static function getGetUser($getUser)
{
    return $userName = $getUser ?? 'nobody';
}