StupidRalph
08-05-2007, 06:54 AM
In which situations do you find yourself using type casting opposed to using the val functions?
I was just using the ctype_digit() and I have to pass a string into the function for it to work. And I didn't know if I should've used strval() to use the string value of my number OR if I should have type casted it to be a string when I declared the variable. (Afterwards its going to be inserted into into the database tinyINT field.) I guess strval() would be more appropiate in this situation no!?! I just didn't want to clutter up my if statement with another function.
I was just using the ctype_digit() and I have to pass a string into the function for it to work. And I didn't know if I should've used strval() to use the string value of my number OR if I should have type casted it to be a string when I declared the variable. (Afterwards its going to be inserted into into the database tinyINT field.) I guess strval() would be more appropiate in this situation no!?! I just didn't want to clutter up my if statement with another function.