note 99264 deleted from function.json-encode by cmb

From: Date: Mon, 21 Nov 2016 19:47:46 +0000
Subject: note 99264 deleted from function.json-encode by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207318@lists.php.net to get a copy of this message
Note Submitter: gansbrest ---- 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: <?php $testArr['key'] = '1'; print json_encode($testArr); ?> ===> {"key":"1"} <?php $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.

« previous php.notes (#207318) next »