note 98987 deleted from function.json-encode by tularis

From: Date: Thu, 04 Feb 2016 08:33:00 +0000
Subject: note 98987 deleted from function.json-encode by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-204855@lists.php.net to get a copy of this message
Note Submitter: Arne Bech ---- To battle the quoting of numbers when encoding data retrieved from mysql you could do a simple preg_replace() to remove the quotes on numbers. This has worked for me: <?php $json = json_encode($dataFromMysql); $json = preg_replace('/"(-?\d+\.?\d*)"/', '$1', $json); ?>

« previous php.notes (#204855) next »