PHP Classes

File: src/compat/poly.php

Recommend this page to a friend!
  Packages of Hernádi Tamás   Rasher PHP Data Access Layer Helper - Database Repository   src/compat/poly.php   Download  
File: src/compat/poly.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Rasher PHP Data Access Layer Helper - Database Repository
Attribute-based PHP data access layer with repos
Author: By
Last change: Update of src/compat/poly.php
Date: 2 months ago
Size: 901 bytes
 

Contents

Class file image Download
<?php
// src/compat/poly.php

if (!function_exists("str_contains")) {
    function
str_contains(string $haystack, string $needle): bool
   
{
        return
$needle !== '' && strpos($haystack, $needle) !== false;
    }
}

if (!
function_exists("str_starts_with")) {
    function
str_starts_with(string $haystack, string $needle): bool
   
{
        return
$needle !== '' && strpos($haystack, $needle) === 0;
    }
}

if (!
function_exists("str_ends_with")) {
    function
str_ends_with(string $haystack, string $needle): bool
   
{
        if (
$needle === '') {
            return
true;
        }
        return
substr($haystack, -strlen($needle)) === $needle;
    }
}

if (!
function_exists("array_is_list")) {
    function
array_is_list(array $array): bool
   
{
        if (
$array === []) {
            return
true;
        }
        return
array_keys($array) === range(0, count($array) - 1);
    }
}