[thelist] PHP - strings and integers
Shashank Tripathi
sub at shanx.com
Mon Apr 8 10:38:01 CDT 2002
Hi Lach,
| php, so it comes originally as a string. This presents a
| problem, because I can't test to see if the number passed
What is your purpose in testing the type of a variable? In PHP, a
variable does not require formal declaration, it will automatically be
declared when a value is assigned to it. So if your variable contains a
substring of the slashed-string that you pass as a part of the URL, then
that variable will automatically be an integer (assuming you do the
splitting right).
Note that PHP is different in this regard from Java or C++ ....variables
do not have declared types. A variable's type does not have to be fixed,
meaning it can be changed over the variable's lifetime as well!
If for some inadequately explored reason you really must make sure that
the value you are using is an integer, then check out the intval()
function.
Enjoy the flexibility,
Shanx
More information about the thelist
mailing list