note 99264 added to function.json-encode

From: Date: Fri, 06 Aug 2010 19:42:06 +0000
Subject: note 99264 added to function.json-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-171441@lists.php.net to get a copy of this message
If you have problems with quotes when encoding numeric data retrieved from the database, you can just cast that value to integer and there will be no quotes: $testArr['key'] = '1'; print json_encode($testArr); ===> {"key":"1"} $testArr['key'] = (int)'1'; print json_encode($testArr); ===> {"key":1} Don't forget that you have to deal with numbers, otherwise your string will be converted to 0. ---- Server IP: 69.147.83.197 Probable Submitter: 38.96.155.54 ---- Manual Page -- http://www.php.net/manual/en/function.json-encode.php Edit -- https://master.php.net/note/edit/99264 Del: integrated -- https://master.php.net/note/delete/99264/integrated Del: useless -- https://master.php.net/note/delete/99264/useless Del: bad code -- https://master.php.net/note/delete/99264/bad+code Del: spam -- https://master.php.net/note/delete/99264/spam Del: non-english -- https://master.php.net/note/delete/99264/non-english Del: in docs -- https://master.php.net/note/delete/99264/in+docs Del: other reasons-- https://master.php.net/note/delete/99264 Reject -- https://master.php.net/note/reject/99264 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#171441) next »