Link to home
Start Free TrialLog in
Avatar of derek4716
derek4716Flag for United States of America

asked on

easy if statement question

I know i can do the following to see if a variable doesn't have a value:

if($test eq ''){

But how do I have it look to see if it has a value(any value at all)

for example

if($test eq '*'){

is this possible thanks
ASKER CERTIFIED SOLUTION
Avatar of tarunsachdeva
tarunsachdeva

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of joeasp
joeasp

You can also do if($test){...}

This checks if it has a non-zero value, which would be in the case of an integer equaling a zero or a string with no content.  Similarly you can check to see if a variable has even been created by going like this:

if(exists$test){...}