Solved

using "if" and "strlen()" or "empty()" in PHP

Posted on 2009-07-07
3
886 Views
Last Modified: 2013-12-13
this should be simple, i think.

i need to determine if $sDancers does not contain data and not execute an email. if $sDancers does have data, then send the email.

this is what i have right now, which doesn't work.

could i use empty() instead?
$Zval  = 0;

	

	if (!strlen($sDancers) <> $Zval) {

		mail ($tomb, $subject1, $body1, $header); //email to mario

		}

Open in new window

0
Comment
Question by:ironpen45
  • 2
3 Comments
 

Expert Comment

by:mpete510
ID: 24797704
I believe removing the ! from the if statement should fix your problem.
$Zval  = 0;

        

        if (strlen($sDancers) <> $Zval) {

                mail ($tomb, $subject1, $body1, $header); //email to mario

                }

Open in new window

0
 

Accepted Solution

by:
mpete510 earned 125 total points
ID: 24797712
Also, inequality in PHP is done with !=, not <>.
if (strlen($sDancers) != $Zval)

Open in new window

0
 

Author Closing Comment

by:ironpen45
ID: 31600771
that did it! thanks!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now