Guys what is wrong with my code? Why it gives me an output "hi"! Can you explain it to me. Please. Thank You!

<?php
        $a = "Unemployed";
        if ($a == "Employed, Locally" or "Employed, Abroad"){
            echo "hi";
            }
        elseif ($a == "Unemployed"){
            echo "hello";
            }
      ?>

Recommended Answers

All 3 Replies

`

 <?php
    $a = "Unemployed";
    if ($a == "Employed, Locally"  || $a == "Employed, Abroad"){
    echo "hi";
    }
    elseif ($a == "Unemployed"){
    echo "hello";
    }
    ?>`

You need:

if ($a == "Employed, Locally" or $a == "Employed, Abroad")

Thank You!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.