Not equal to != and !== in PHP

== and != do not take into account the data type of the variables you compare. So these would all return true: ‘0’ == 0 false == 0 NULL == false === and !== do take into account the data type. That means comparing a string to a boolean will never be true because they’re … Read more

What’s the difference between ++$i and $i++ in PHP?

++$i is pre-increment whilst $i++ post-increment. pre-increment: increment variable i first and then de-reference. post-increment: de-reference and then increment i “Take advantage of the fact that PHP allows you to post-increment ($i++) and pre-increment (++$i). The meaning is the same as long as you are not writing anything like $j = $i++, however pre-incrementing is … Read more

What is the difference between “::” “.” and “->” in c++ [duplicate]

1.-> for accessing object member variables and methods via pointer to object Foo *foo = new Foo(); foo->member_var = 10; foo->member_func(); 2.. for accessing object member variables and methods via object instance Foo foo; foo.member_var = 10; foo.member_func(); 3.:: for accessing static variables and methods of a class/struct or namespace. It can also be used … Read more