PHP code example of denisok94 / helper

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

    

denisok94 / helper example snippets


use \denisok94\helper\Helper as H;
H::methodName($arg);

H::createDate('yesterday'); // yesterday
H::createDate('-1 day'); // yesterday
H::createDate('1 day'); // tomorrow 

H::modifyDate('2006-12-12', '-1 day'); // 2006-12-11
H::modifyDate(H::currentDate(), '+1 day'); // tomorrow
H::modifyDate(H::currentDt(), '-1 day', 'Y-m-d H:i:s'); // yesterday

H::getStamp('22-09-2008 00:00:00', 'd-m-Y H:i:s'); // 1222030800 (This will differ depending on your server time zone...)
H::getStamp('22-09-2008 00:00:00', 'd-m-Y H:i:s', 'UTC'); // 1222041600
H::getStamp(H::currentDt())

use \denisok94\helper\other\MicroTimer;
$queryTimer = new MicroTimer(); // start
// code ...
$queryTimer->stop();

// result:
$time = $queryTimer->elapsed(); 
// or/and
printf($queryTimer);

use \denisok94\helper\other\Console;
// php console.php arg1 arg2=val -o -a5 --option --option1=6 --option1=3
$console = new Console();
$console->getArguments(); // [arg1,arg2=>val]
$console->getArgument(0); // arg1
$console->getArgument('arg2'); // val
$console->getOptions(); // [o=>null,a=>5,option=>null,option1=>[6,3]]

use \denisok94\helper\other\Console;
try {
    $console = new Console([
        'test', // // 

use \denisok94\helper\other\Console;
$console = new Console(null, true);
$console->getOptions(); // [o=>true,option=>true,...]