Index on $hostParts array looks wrong to me
Closed this issue · 1 comments
nicksanders commented
Shouldn't it be $hostParts[(count($hostParts) - 2)] ?
dev-kraken commented
Using count($hostParts) - 1
correctly identifies the top-level domain (TLD) because it retrieves the last element of the hostParts
array, which is split by dots. For example, in example.com
, hostParts
is ['example', 'com']
, and com
is the TLD. Using count($hostParts) - 2
would incorrectly access the second-level domain, example
, not the TLD.