PHP Classes

File: src/Helpers/types.php

Recommend this page to a friend!
  Classes of AccountKiller   Fuse   src/Helpers/types.php   Download  
File: src/Helpers/types.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Fuse
Fuzzy search of arrays using the Bitap algorithm
Author: By
Last change:
Date: 1 year ago
Size: 511 bytes
 

Contents

Class file image Download
<?php

namespace Fuse\Helpers\Types;

function
isArray($value): bool
{
    if (!
is_array($value)) {
        return
false;
    }

    foreach (
$value as $key => $_) {
        if (!
is_int($key)) {
            return
false;
        }
    }

    return
true;
}

function
isAssoc($value): bool
{
    return
is_array($value) && !isArray($value);
}

function
isNumber($value): bool
{
    return
is_int($value) || is_float($value);
}

function
isBlank(string $value): bool
{
    return
mb_strlen(trim($value)) === 0;
}