- implode: documentation ( source)
- explode: documentation ( source)
<?php
$a = array("nl", "net", "com");
$domain = explode(".", '.ne');
foreach($a as $c) {
echo (strlen($domain[1]) - 1);
if($c[(strlen($domain[1]) - 1)] == $domain[1]) {
$matches[]= $c;
}
}
if(!empty($matches)) {
echo implode(',', $matches);
} else {
echo 'no matches';
}