note 107326 added to function.is-numeric

From: Date: Tue, 31 Jan 2012 04:30:47 +0000
Subject: note 107326 added to function.is-numeric
Groups: php.notes 
Request: Send a blank email to php-notes+get-185805@lists.php.net to get a copy of this message
If you want the numerical value of a string, this will return a float or int value: function get_numeric($val) { if (is_numeric($val)) { return $val + 0; } return 0; } Example: get_numeric('3'); // int(3) get_numeric('1.2'); // float(1.2) get_numeric('3.0'); // float(3) ---- Server IP: 208.69.120.55 Probable Submitter: 24.130.142.4 ---- Manual Page -- http://www.php.net/manual/en/function.is-numeric.php Edit -- https://master.php.net/note/edit/107326 Del: integrated -- https://master.php.net/note/delete/107326/integrated Del: useless -- https://master.php.net/note/delete/107326/useless Del: bad code -- https://master.php.net/note/delete/107326/bad+code Del: spam -- https://master.php.net/note/delete/107326/spam Del: non-english -- https://master.php.net/note/delete/107326/non-english Del: in docs -- https://master.php.net/note/delete/107326/in+docs Del: other reasons-- https://master.php.net/note/delete/107326 Reject -- https://master.php.net/note/reject/107326 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185805) next »