Jump to content

[SOLVED] Why is 1 Not Equal to 1 ??


phpdolan

Recommended Posts

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.

  :o:-[ 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.

Link to comment
https://forums.phpfreaks.com/topic/142485-solved-why-is-1-not-equal-to-1/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.