PHP code example of mordilion / mutils

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

    

mordilion / mutils example snippets




$array = [128, 2, 16, 64, 8, 1, 32];

// or MUtils\Arrays::userAssociativeSort()
MUtils\Arrays\uasort($array, static function ($left, $right) {
    return $left <=> $right;
})



// or MUtils\Strings::startsWith()
if (MUtils\Strings\str_starts_with('Some Text', 'Some')) {
    // ...
}



// or MUtils\Bits::isset()
if (MUtils\Bits\bit_isset(12, 4)) {
    // ...
}



// or MUtils\Objects::getReflectionMethod()
$instance = new Something();
$method = MUtils\Objects\get_reflection_method($instance, 'foo');
if ($method) {
    $method->invoke($instance, 'arg');
    // ...
}