summaryrefslogtreecommitdiff
path: root/ext/json/tests/json_decode_basic.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/tests/json_decode_basic.phpt')
-rw-r--r--ext/json/tests/json_decode_basic.phpt57
1 files changed, 24 insertions, 33 deletions
diff --git a/ext/json/tests/json_decode_basic.phpt b/ext/json/tests/json_decode_basic.phpt
index 6dbeadb367..0bc939c257 100644
--- a/ext/json/tests/json_decode_basic.phpt
+++ b/ext/json/tests/json_decode_basic.phpt
@@ -1,50 +1,41 @@
--TEST--
Test json_decode() function : basic functionality
--SKIPIF--
-<?php
-if (!extension_loaded("json")) {
- die('skip JSON extension not available in this build');
-}
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-/* Prototype : mixed json_decode ( string $json [, bool $assoc ] )
- * Description: Decodes a JSON string
- * Source code: ext/json/php_json.c
- * Alias to functions:
- */
echo "*** Testing json_decode() : basic functionality ***\n";
// array with different values for $string
$inputs = array (
- '0',
- '123',
- '-123',
- '2147483647',
- '-2147483648',
- '123.456',
- '1230',
- '-1230',
- 'true',
- 'false',
- 'null',
- '"abc"',
- '"Hello World\r\n"',
- '[]',
- '[1,2,3,4,5]',
- '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}',
- '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}',
- '""',
- '{}'
+ '0',
+ '123',
+ '-123',
+ '2147483647',
+ '-2147483648',
+ '123.456',
+ '1230',
+ '-1230',
+ 'true',
+ 'false',
+ 'null',
+ '"abc"',
+ '"Hello World\r\n"',
+ '[]',
+ '[1,2,3,4,5]',
+ '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}',
+ '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}',
+ '""',
+ '{}'
);
// loop through with each element of the $inputs array to test json_decode() function
$count = 1;
foreach($inputs as $input) {
- echo "-- Iteration $count --\n";
- var_dump(json_decode($input));
- var_dump(json_decode($input, TRUE));
- $count ++;
+ echo "-- Iteration $count --\n";
+ var_dump(json_decode($input));
+ var_dump(json_decode($input, true));
+ $count++;
}
?>