| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/nice2/libraries/vendor/jfcherng/php-diff/src/Utility/ |
Upload File : |
<?php
declare(strict_types=1);
namespace Jfcherng\Diff\Utility;
final class Arr
{
/**
* Get a partial array slice with start/end indexes.
*
* @param array $array the array
* @param int $start the starting index (negative = count from backward)
* @param null|int $end the ending index (negative = count from backward)
* if is null, it returns a slice from $start to the end
*
* @return array array of all of the lines between the specified range
*/
public static function getPartialByIndex(array $array, int $start = 0, ?int $end = null): array
{
$count = \count($array);
// make $end set
$end ??= $count;
// make $start non-negative
if ($start < 0) {
$start += $count;
if ($start < 0) {
$start = 0;
}
}
// make $end non-negative
if ($end < 0) {
$end += $count;
if ($end < 0) {
$end = 0;
}
}
// make the length non-negative
return \array_slice($array, $start, max(0, $end - $start));
}
/**
* Determines whether the array is associative.
*
* @param array $arr the array
*
* @return bool `true` if the array is associative, `false` otherwise
*/
public static function isAssociative($arr): bool
{
foreach ($arr as $key => $value) {
if (\is_string($key)) {
return true;
}
}
return false;
}
}