• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 146
  • Last Modified:

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
0
derek4716
Asked:
derek4716
1 Solution
 
tarunsachdevaCommented:
Just use:

if ($test ne '') { ... }
0
 
joeaspCommented:
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){...}
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now