Is there a way to have a variable recognized as a string even if it
contains a valid integer? I have a script that is taking strings from a
file that can be numbers, including zero. I have an if statement to
simply see if the variable exists (otherwise I need to throw an error),
and if the variable contains 0, the if statement is failing. Right now,
my code is essentially:
if ($variable) {
# act on $variable
} else {
# throw error
}
Is there an easy way to get the if statement to recognize a 0, or do I
need to add a special case? I don't care to keep the 0 as an integer,
if I can change it to a string somehow, that would work great.
---
Jesse Farrell