Page MenuHomeDevCentral

ArrayUtilities.php
No OneTemporary

ArrayUtilities.php

<?php
declare(strict_types=1);
namespace Keruald\OmniTools\Collections;
use Closure;
class ArrayUtilities {
///
/// Methods to transform every member of an array
///
/**
* @return int[]
*/
public static function toIntegers (array $array) : array {
$newArray = $array;
array_walk($newArray, self::toIntegerCallback());
return $newArray;
}
///
/// Helpers to get callbacks for array_walk methods
///
public static function toIntegerCallback () : Closure {
return function (&$item) {
$item = (int)$item;
};
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Feb 28, 21:39 (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2433845
Default Alt Text
ArrayUtilities.php (622 B)

Event Timeline