PHP code example of misantron / php-utils

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

    

misantron / php-utils example snippets


use Utility\UArray;  
use Utility\UString;  
use Utility\UTime;

$array = [  
    ['name' => 'Alex', 'age' => 25],  
    ['name' => 'Sara', 'age' => 21],  
    ['name' => 'John', 'age' => 28]  
];  
$string = '..C’est du français !';  
$date1 = new \DateTime('2015-02-26 13:05');  
$date2 = new \DateTime('2015-02-26 22:16');  

$result1 = UArray::extractColumn($array, 'age');  
$result2 = UString::slug($string);  
$result3 = UTime::secondsDiff($date1, $date2);

var_dump($result1, $result2, $result3);

[25, 21, 28];  
'c-est-du-francais';  
33060;
shell
$ composer 
json
"misantron/php-utils": "dev-master"