If-Condition: why turn a logical into an integer?

I saw a condition like this:

if ((int)method_exists($this, $this->endpoint) > 0)

What is behind this? What an advantage over the obvious

if (method_exists($this, $this->endpoint))

?

(Source: http://coreymaynard.com/blog/creating-a-restful-api-with-php/ )

+4
source share
1 answer

I see no advantage of turning it into an integer. because method_exists already return a boolean value. This is a long and useless coding method.

if statement requires a logical expression, and the exists method returns a boolean, the added process has the same result as using the method_exists method (but from time to time and the processor, so please do not do this: D)

+5
source

All Articles