note 92370 added to function.is-int

From: Date: Tue, 21 Jul 2009 18:39:40 +0000
Subject: note 92370 added to function.is-int
Groups: php.notes 
Request: Send a blank email to php-notes+get-158557@lists.php.net to get a copy of this message
Use this instead if you wanna know if a string is explicitly a number: <?php function isint( $mixed ) { return ( preg_match( '/^\d*$/' , $mixed) == 1 ); } var_export( isint( '123' ) ); //This will return true var_export( isint( 123 ) ); //This will return true var_export( isint( 'asd' ) ); //This will return false var_export( isint( '123asd123' ) ); //This will return false ?> ---- Server IP: 201.216.232.3 Probable Submitter: 201.254.109.19 ---- Manual Page -- http://www.php.net/manual/en/function.is-int.php Edit -- https://master.php.net/note/edit/92370 Del: integrated -- https://master.php.net/note/delete/92370/integrated Del: useless -- https://master.php.net/note/delete/92370/useless Del: bad code -- https://master.php.net/note/delete/92370/bad+code Del: spam -- https://master.php.net/note/delete/92370/spam Del: non-english -- https://master.php.net/note/delete/92370/non-english Del: in docs -- https://master.php.net/note/delete/92370/in+docs Del: other reasons-- https://master.php.net/note/delete/92370 Reject -- https://master.php.net/note/reject/92370 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158557) next »