list-of-top-level-domains/examples/php-demo.php

23 lines
519 B
PHP
Raw Normal View History

2017-12-14 06:48:32 +00:00
<?php
use TldEnum\TldEnum;
//require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/../vendor/autoload.php';
echo "There are " . count(TldEnum::TLD_ENUM) . " IANA TLDs\n";
$tldCheck = "com";
echo "Is '$tldCheck' a real TLD?\n";
if (in_array($tldCheck, TldEnum::TLD_ENUM)) {
echo " yes\n";
} else {
echo " no\n";
}
$tldCheck = "somethingWeird";
echo "Is '$tldCheck' a real TLD?\n";
if (in_array($tldCheck, TldEnum::TLD_ENUM)) {
echo " yes\n";
} else {
echo " no\n";
}