False0, false! 0. problem: the php document shows the statement socket_create () failed to create returnfalse, but why is this sentence correct {code ...} creation error. $ resource should be false. An exception is thrown. The problem is false & amp; lt; 0... false = 0, false! = 0,
Problem:
In the php document, socket_create () fails to be created. return false
But why is this sentence correct?
if (($resource = socket_create(....)) < 0 ){ throw new Exception("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");}
Creation error. $ resource should be false. An exception is thrown. The problem is: false <0 is true. why?
I am a Tom. I want to ask if I want to understand it.
Reply content:
False = 0, false! = 0,
Problem:
In the php document, socket_create () fails to be created. return false
But why is this sentence correct?
if (($resource = socket_create(....)) < 0 ){ throw new Exception("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");}
Creation error. $ resource should be false. An exception is thrown. The problem is: false <0 is true. why?
I am a Tom. I want to ask if I want to understand it.
0 and false are incomplete. Obviously, 0 is of the int type, and false is of the Boolean type.
0 = false // This condition is true and the value is equal
0 = false // This is not true, the type and value are equal, only true
There should be a problem with this writing: I tested
if (($resource = socket_create('1', SOCK_STREAM, SOL_TCP)) < 0) { throw new Exception("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");}
Not included in the if statement