I started having hands with regular expressions in PHP and stuck in start.
I have written following block:-
$object = "ng_amg_gt-1";
switch ($object)
{
case preg_match('/^ng_amg_gt-[0-9]+$/', $object):
echo 'first';
break;
case preg_match('/^ng_amg_gt-_cg-[0-9]+$/', $object):
echo 'second';
break;
}
I thought "ng_amg_gt-1" will match preg_match('/^ng_amg_gt-[0-9]+$/', $object) but interestingly(anoyingly) it is echoing second.
What I am missing?
PS :- It may seem an obvious question but not getting any breakthrough, thats why I have posted it over here.
Thanks
if (preg_match(...))