File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / json / tests / json_encode_numeric.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:40 2012 UTC (12 years, 2 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
Test json_encode() function with numeric flag
--SKIPIF--
<?php
if (!extension_loaded("json")) {
	die('skip JSON extension not available in this build');
}	 
?>
--FILE--
<?php
var_dump(
	json_encode("1", JSON_NUMERIC_CHECK),
	json_encode("9.4324", JSON_NUMERIC_CHECK),
	json_encode(array("122321", "3232595.33423"), JSON_NUMERIC_CHECK),
	json_encode("1"),
	json_encode("9.4324"),
	json_encode(array("122321", "3232595.33423"))
);
?>
--EXPECT--
string(1) "1"
string(6) "9.4324"
string(22) "[122321,3232595.33423]"
string(3) ""1""
string(8) ""9.4324""
string(26) "["122321","3232595.33423"]"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>