1--TEST-- 2SplFixedArray serialisation 3--FILE-- 4<?php 5 6$array = new SplFixedArray(5); 7 8$obj = new stdClass; 9$obj->prop = 'value'; 10 11$array[0] = 'foo'; 12$array[2] = 42; 13$array[3] = $obj; 14$array[4] = range(1, 5); 15 16$ser = serialize($array); 17echo "$ser\n"; 18$unser = unserialize($ser); 19 20printf("count: %d\n", count($unser)); 21printf("getSize(): %d\n", $unser->getSize()); 22 23var_dump($unser[0], $unser[1], $unser[2], $unser[3], $unser[4]); 24 25$unser[4] = 'quux'; 26var_dump($unser[4]); 27 28?> 29--EXPECT-- 30O:13:"SplFixedArray":5:{i:0;s:3:"foo";i:1;N;i:2;i:42;i:3;O:8:"stdClass":1:{s:4:"prop";s:5:"value";}i:4;a:5:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;}} 31count: 5 32getSize(): 5 33string(3) "foo" 34NULL 35int(42) 36object(stdClass)#4 (1) { 37 ["prop"]=> 38 string(5) "value" 39} 40array(5) { 41 [0]=> 42 int(1) 43 [1]=> 44 int(2) 45 [2]=> 46 int(3) 47 [3]=> 48 int(4) 49 [4]=> 50 int(5) 51} 52string(4) "quux" 53