mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

This returns an array for SplFixedArray JSON encoding, which is more appropriate than an object with integer string keys. Closes GH-7117.
18 lines
264 B
PHP
18 lines
264 B
PHP
--TEST--
|
|
json_encode() on SplFixedArray
|
|
--FILE--
|
|
<?php
|
|
|
|
echo json_encode(new SplFixedArray()) . "\n";
|
|
echo json_encode(new SplFixedArray(1)) . "\n";
|
|
|
|
$a = new SplFixedArray(3);
|
|
$a[0] = 0;
|
|
$a[2] = 2;
|
|
echo json_encode($a) . "\n";
|
|
|
|
?>
|
|
--EXPECT--
|
|
[]
|
|
[null]
|
|
[0,null,2]
|