Why use strcmp instead of equal comparison to determine URI scheme

149 Views Asked by At

In a class file, I saw the following code:

$uriParts = parse_url($uri);
$this->port = strcmp('https', $uriParts['scheme']) ? 80 : 443;

I know, the part $uriParts['scheme'] provides either of the schemes like http, https, ftp or anything but why the above line used strcmp function instead of using the following code

$this->port = ('https' !== $uriParts['scheme']) ? 80 : 443;

Doest it have any specific reason or just like that??

0

There are 0 best solutions below