Solved

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

Posted on 2009-07-07
3
898 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
[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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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 count occurrences of each item in an array.

733 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