PHP code example of stigwue / happrox

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

    

stigwue / happrox example snippets




//set time zone, no where like home
date_default_timezone_set('Africa/Lagos');

$obj = new Happrox();

echo "Numbers\n";

$happrox = Happrox::number($obj, 10);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::number($obj, 1010);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::number($obj, 123456);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::number($obj, 1010101);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::number($obj, 12345678);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::number($obj, 101010101010);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";

Happrox::setDurationBase($obj, time(NULL));

echo "Durations\n";

$happrox = Happrox::duration($obj, 36);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::duration($obj, 3599);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::duration($obj, 518400);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::duration($obj, 604799);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";
$happrox = Happrox::duration($obj, 123456);
echo $happrox['value'] . ' -> ' . $happrox['happrox'] . "\n";