note 81405 added to function.is-numeric

From: Date: Tue, 26 Feb 2008 17:00:32 +0000
Subject: note 81405 added to function.is-numeric
Groups: php.notes 
Request: Send a blank email to php-notes+get-136504@lists.php.net to get a copy of this message
Test if the first character is numeric or not: function first_char_numeric($str){ $count = strlen($str); $test = substr($str, -$count, 1); if (is_numeric($test)) { return true; } else { return false; } } $str = "abcde"; // returns false // $str = "2abcde"; // returns true if(first_char_numeric($str) == "true") { echo "First character is numeric"; }else{ echo "First character is not numeric"; } ---- Server IP: 209.41.74.194 Probable Submitter: 72.241.194.209 ---- Manual Page -- http://www.php.net/manual/en/function.is-numeric.php Edit -- https://master.php.net/note/edit/81405 Del: integrated -- https://master.php.net/note/delete/81405/integrated Del: useless -- https://master.php.net/note/delete/81405/useless Del: bad code -- https://master.php.net/note/delete/81405/bad+code Del: spam -- https://master.php.net/note/delete/81405/spam Del: non-english -- https://master.php.net/note/delete/81405/non-english Del: in docs -- https://master.php.net/note/delete/81405/in+docs Del: other reasons-- https://master.php.net/note/delete/81405 Reject -- https://master.php.net/note/reject/81405 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136504) next »