Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Test of preg_match replacement
<?php
t(
array(
'www.notft.com',
'ft.com',
'.ft.com',
'x.ft.com.au',
'x.ft.com',
),
function ($t)
{
return preg_match('/^(.+)\.ft\.com$/', $t);
},
function ($t)
{
return (substr($t, -7) === '.ft.com') && strlen($t) > 7;
}
);
function t($ta, $o, $n)
{
foreach ($ta as $t) {
printf(
'OLD:%d -- NEW:%d -- %s' . PHP_EOL,
$o($t),
$n($t),
$t
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.