downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SplFixedArray::getSize> <SplFixedArray::current
Last updated: Fri, 20 Nov 2009

view this page in

SplFixedArray::fromArray

(PHP 5 >= 5.3.0)

SplFixedArray::fromArrayImport a PHP array in a SplFixedArray instance

Description

public static SplFixedArray SplFixedArray::fromArray ( array $array [, boolean $save_indexes ] )

Import the PHP array array in a new SplFixedArray instance

Parameters

array

The array to import.

save_indexes

Try to save the numeric indexes used in the original array. Defaults to TRUE.

Return Values

Returns an instance of SplFixedArray containing the array content.

Examples

Example #1 SplFixedArray::fromArray() example

<?php
$fa 
SplFixedArray::fromArray(array(=> 1=> 2=> 3));

var_dump($fa);

$fa SplFixedArray::fromArray(array(=> 1=> 2=> 3), false);

var_dump($fa);
?>

The above example will output:

object(SplFixedArray)#1 (4) {
  [0]=>
  int(2)
  [1]=>
  int(1)
  [2]=>
  NULL
  [3]=>
  int(3)
}
object(SplFixedArray)#2 (3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}



add a note add a note User Contributed Notes
SplFixedArray::fromArray
There are no user contributed notes for this page.

SplFixedArray::getSize> <SplFixedArray::current
Last updated: Fri, 20 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites