This is the right answer
preg_match("/^[0-9]+$/", $yourstr);
This function return TRUE(1) if it matches or FALSE(0) if it doesn't
Quick Explanation :
'^' : means that it should begin with the following ( in our case is a range of digital numbers [0-9] ) ( to avoid cases like ("abdjdf125") )
'+' : means there should be at least one digit
'$' : means after our pattern the string should end ( to avoid cases like ("125abdjdf") )