WordPress at Your Fingertips
function is not described

SplFixedArray::fromArray() public WP 1.0

{} It's a method of the class: SplFixedArray{}

No Hooks.

Return

SplFixedArray.

Usage

$result = SplFixedArray::fromArray( $array, $save_indexes );
$array(array) (required)
-
$save_indexes *(true false)*

Default: true

Code of SplFixedArray::fromArray() WP 5.8.2

public static function fromArray(array $array, $save_indexes = true)
{
    $self = new SplFixedArray(count($array));
    if($save_indexes) {
        foreach($array as $key => $value) {
            $self[(int) $key] = $value;
        }
    } else {
        $i = 0;
        foreach (array_values($array) as $value) {
            $self[$i] = $value;
            $i++;
        }
    }
    return $self;
}