Reputation: 367
I read a string from a config file:
boolean = true
Although in php $config["boolean"] => String(1) "1"
is there any difference?
Upvotes: 0
Views: 583
Reputation: 479
Yes difference exists...
In this case
if ('1') and if ('true')
'1' first be converted to true, then executed... But result has been always same...
Of course, exist small speed difference(then need concerted types it's take a little bit more time to do that)... But it's like always - nobody cares :-D
Good to know:
if ( 1 == true) { } // returns true
if ( 1 === true) { } // returns false
Upvotes: 3