salihk. Posted June 13, 2010 Share Posted June 13, 2010 Hello everyone, I have no well knowledge about php coding. I am trying to write simple php code for take some datas from mysql. My problem is whhen i try to control my values that i take from get html with get command. if(!is_int($_REQUEST["num"]) die('It is not integer'); When i put integer to num variable for example 2 it prints It is not integer. Maybe i misunderstand the "!" think. Could you help me to figure out Thanks Quote Link to comment https://forums.phpfreaks.com/topic/204646-is_int/ Share on other sites More sharing options...
Daniel0 Posted June 13, 2010 Share Posted June 13, 2010 Things that are in $_REQUEST will never be integers. They are always strings. is_int checks the data type, not the contents. You can use ctype_digit to solve your problem. Quote Link to comment https://forums.phpfreaks.com/topic/204646-is_int/#findComment-1071453 Share on other sites More sharing options...
salihk. Posted June 13, 2010 Author Share Posted June 13, 2010 But in order to check the function is_int() works or not i assigned the num value to a variable $num=$_REQUEST["num"] and add an integer $num=$_REQUEST["num"] +1; so it is output was correct than i put it to if(is_not($num)) die('it is integer'); it prints it is integer than change the code to if(!is_not($num)) die('it is not integer'); and the result is the same it prints again :-\ Quote Link to comment https://forums.phpfreaks.com/topic/204646-is_int/#findComment-1071461 Share on other sites More sharing options...
salihk. Posted June 13, 2010 Author Share Posted June 13, 2010 By the way your suggestion works properly thanks but i am confused Quote Link to comment https://forums.phpfreaks.com/topic/204646-is_int/#findComment-1071462 Share on other sites More sharing options...
Alex Posted June 13, 2010 Share Posted June 13, 2010 What's is_not()? Quote Link to comment https://forums.phpfreaks.com/topic/204646-is_int/#findComment-1071467 Share on other sites More sharing options...
Daniel0 Posted June 13, 2010 Share Posted June 13, 2010 It's the magic function that reads your mind to make sure it's not whatever you think of Quote Link to comment https://forums.phpfreaks.com/topic/204646-is_int/#findComment-1071468 Share on other sites More sharing options...
salihk. Posted June 13, 2010 Author Share Posted June 13, 2010 I don't know it should be is_int() I have been working for 12319412409 hours it can happen Quote Link to comment https://forums.phpfreaks.com/topic/204646-is_int/#findComment-1071473 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.