Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8161073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:25:10+00:00 2026-06-06T18:25:10+00:00

if($hOne!=”) { echo ‘yes’; } else { echo ‘no’; } SO for a while

  • 0
if($hOne!='') {
   echo 'yes';
 } else {
   echo 'no';
}

SO for a while i have been using the above code to determine id X variable has been set, now this was working ok until working on a wordpress site (i wont go into too much details) but basically initially the varabile has never been touched and works as intended, if you enter a value and then delete that value it seems to think its been set.

a way i got round this is to use the below code, my question is, is there a better way to do this.

Cheers

if (preg_match('/[A-Za-z]/i', $hone)) {
       echo 'yes';
     } else {
       echo 'no';
    }

Result Used the below which works as intended, thank you all:

if(isset($hone) and
       !empty($hone)) {
        echo '1';
    } else {
        echo '2';
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:25:11+00:00Added an answer on June 6, 2026 at 6:25 pm

    Right. My advice is to go back and read the PHP documentation. Make it a week or two project to get most sections at least glimpsed at.

    You want to use isset, or empty.

    if (isset($hOne)) { }
    

    will check if the variable exists,

    if (empty($hOne)) { }
    

    checks if it is set but empty.

    To help you learn PHP, I’d recommend sticking this at the top of your app:

    $test_server = $_SERVER['SERVER_NAME'] == "127.0.0.1" || $_SERVER['SERVER_NAME'] == "localhost" || substr($_SERVER['SERVER_NAME'],0,3) == "192"; 
    
    ini_set('display_errors',$test_server);
    ini_set('display_startup_errors',$test_server);
    
    error_reporting(E_ALL|E_STRICT);
    

    (Or if you are not working locally, just set $test_server to 1.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to continue to hone my technical (programming/design/etc) skills while contributing back
I have decided to hone my minimal web back-end experience (and help a friend)
Mornin' SO! I'm just trying to hone my math-fu, and I have some questions
I'd like to quickly hone in on what failed in a build log output
I am going to have multiple types of an object and I am really
Going through some excercises to hone my binary tree skills, I decided to implement
I want to setup a sandbox environment to hone in on my pl/sql and
I want to spend the summer getting into web development. I have some basic
I've got a C++ template class split into two files using #include directive as
What is considered the best way of handling multiple NSTableViews without using Cocoa Bindings?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.