CodeIgniter Forums
is_int problem ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: is_int problem ? (/showthread.php?tid=28301)



is_int problem ? - El Forum - 03-07-2010

[eluser]Spleshmen[/eluser]
my third uri segment is a number and before i use it i need to check so i am using is_int but its not working ,any chance some one can help me fix this?thanks
Code:
$id = $this->uri->segment(3);
echo $id; //it displays the number from my url
if (is_int($id)==TRUE)
echo 'working';
else
echo 'not working';



is_int problem ? - El Forum - 03-07-2010

[eluser]pistolPete[/eluser]
Have a look at the PHP manual: http://php.net/manual/en/function.is-int.php
Quote:To test if a variable is a number or a numeric string (such as form input, which is always a string), you must use is_numeric().



is_int problem ? - El Forum - 03-07-2010

[eluser]Spleshmen[/eluser]
thanks Smile