[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 606
  • Last Modified:

Ckecking for empty strings in PHP

How do I check if a string variable is empty using PHP? My variable is $name. Presently, I have a statement that looks like this:
if ($name == "") {...} else {...}
but if I enter one or more blank spaces into $name, control passes to the else part. I want to block this and make sure the else part is carried out only if $name is not empty.
Thank you.
A
0
aej1973
Asked:
aej1973
1 Solution
 
snoyes_jwCommented:
if (empty(trim($name))
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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