phpdolan Posted January 26, 2009 Share Posted January 26, 2009 Please point out what you think I may be missing. I've been staring at this for days and can't get it. I've added code to echo what the variables are, included below and that tells me the 2nd part of the following IF is FALSE ?? Yet the output confirms 1 ( the integer values ) does not equal 1, using variables. Sorry about the confusion. I thought 1 = 1. , and ??? if ( $today_date >= 14 AND $work_mon_num == idate ( "m" ) ) { ?> <script type="text/javascript"> setTimeout ( function() { window.scrollTo ( 0, 270 ); }, 2000 ) </script> <?php } echo "work_mo_num is : " . $work_mo_num . ", and is type : ( " . gettype ( $work_mo_num ) . " )<br />"; echo "today_date is : " . $today_date . ", and is type : ( " . gettype ( $work_mo_num ) . " )<br />"; echo ' m for the idate is : ' . idate ( "m" ) . ", and is type : ( " . gettype ( idate ( "m" ) ) . " )<br />"; echo "14 is : " . gettype ( 14 ) . "<br />"; echo '1st half of IF is : '; ($today_date >= 14 ) ? print 'true' : print 'false'; echo '<br />2nd half of IF is : '; ( idate ( "m" ) == $work_mon_num) ? print 'true' : print 'false'; echo "<br />"; ( 1 == 1 ) ? print 'true' : print 'false'; echo '<br />Full IF returns : '; ( $today_date >= 14 AND $work_mon_num == idate ( "m" ) ) ? print 'true' : print 'false'; Here's the output of the code: work_mo_num is : 1, and is type : ( integer ) today_date is : 26, and is type : ( integer ) m for the idate is : 1, and is type : ( integer ) 14 is : integer 1st half of IF is : true 2nd half of IF is : false Test 1 == 1 : true Full IF returns : false I'm stumped. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/142485-solved-why-is-1-not-equal-to-1/ Share on other sites More sharing options...
premiso Posted January 26, 2009 Share Posted January 26, 2009 Try this: print ( 1 == 1 ) ? 'true' : 'false'; That should work. I do not think print works as part of the assignment. It would be like saying $var = print 'true'; which (I believe) is invalid. Quote Link to comment https://forums.phpfreaks.com/topic/142485-solved-why-is-1-not-equal-to-1/#findComment-746576 Share on other sites More sharing options...
rhodesa Posted January 26, 2009 Share Posted January 26, 2009 you are using $work_mon_num when you should be using $work_mo_num Quote Link to comment https://forums.phpfreaks.com/topic/142485-solved-why-is-1-not-equal-to-1/#findComment-746581 Share on other sites More sharing options...
phpdolan Posted January 26, 2009 Author Share Posted January 26, 2009 you are using $work_mon_num when you should be using $work_mo_num rhodesa, Thanks. You're a Genius!!! and I'm further embarrassed. David Quote Link to comment https://forums.phpfreaks.com/topic/142485-solved-why-is-1-not-equal-to-1/#findComment-746605 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.