BrianM Posted June 26, 2008 Share Posted June 26, 2008 = == and === What is the difference between the single, double and triple equal signs, and is there anything higher than 3 used at once? Quote Link to comment https://forums.phpfreaks.com/topic/111971-what-is-the-difference-between/ Share on other sites More sharing options...
amites Posted June 26, 2008 Share Posted June 26, 2008 take a look at the PHP manual http://www.php.net/manual/en/language.operators.php Quote Link to comment https://forums.phpfreaks.com/topic/111971-what-is-the-difference-between/#findComment-574728 Share on other sites More sharing options...
GreenUser Posted June 26, 2008 Share Posted June 26, 2008 One = is the same as, to define Two = is equal to, compare Three = equal variables and same type Haven't seen too much of three being used, interesting. Quote Link to comment https://forums.phpfreaks.com/topic/111971-what-is-the-difference-between/#findComment-574731 Share on other sites More sharing options...
BrianM Posted June 26, 2008 Author Share Posted June 26, 2008 something like <?php if ($GLOBALS['text_dir'] === 'rtl') { echo '*,'; } echo $GLOBALS['cfg']['NaviWidth']; if ($GLOBALS['text_dir'] === 'ltr') { echo ',*'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/111971-what-is-the-difference-between/#findComment-574733 Share on other sites More sharing options...
zenag Posted June 26, 2008 Share Posted June 26, 2008 see this example....it displays null if both values are empty... example1: <? if($_POST["submit"]=='submit') { if($_POST["text"]=="") { echo "null value in text"; } if($_POST["name"]==="") { echo "null value in name"; } } ?> <form action="" method="post"> <br /> <input type="text" name="text" /> <input type="text" name="name" /> <input type="submit" name="submit" value="submit" /> </form> example2: <? if($_POST["submit"]=='submit') { if($_POST["text"]=="") { echo "null value in text"; } if($_POST["name"]==="") { echo "null value in name"; } } ?> <form action="" method="post"> <br /> <input type="text" name="name" /> <input type="submit" name="submit" value="submit" /> </form> it displays same result ..." null values in text null values in text" example3: <? if($_POST["submit"]=='submit') { if($_POST["text"]=="") { echo "null value in text"; } if($_POST["name"]==="") { echo "null value in name"; } } ?> <form action="" method="post"> <br /> <input type="text" name="text" /> <input type="submit" name="submit" value="submit" /> </form> it displays only null values in text.... since "===" operator checks for values as well as occurence of text box name in the form... Quote Link to comment https://forums.phpfreaks.com/topic/111971-what-is-the-difference-between/#findComment-574752 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.