- end: documentation ( source)
- explode: documentation ( source)
- in_array: documentation ( source)
<?php
$proper_urls = array('.com', '.pl', '.co.uk', '.com.pl', '.org');
$website = 'fdsfsdf.pl';
$web = explode('.', $website);
echo end($web);
if(in_array("." . end($web), $proper_urls))
{
echo 'valid';
}
else
{
echo 'not valid';
}