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
Thu, Dec 26, 16:26 (8 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2315189
Default Alt Text
ArrayUtilities.php (622 B)

Event Timeline