?
Solved

easy if statement question

Posted on 2003-03-08
2
Medium Priority
?
140 Views
Last Modified: 2013-12-25
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
Comment
Question by:derek4716
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
tarunsachdeva earned 500 total points
ID: 8096220
Just use:

if ($test ne '') { ... }
0
 
LVL 1

Expert Comment

by:joeasp
ID: 8096630
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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question