I need to have a case that checks for a few first characters, and then accept any other 7 characters. Something like this:
DN98???????
I tried doing it like this:
case 'DN98'+'[a-zA-Z0-9]':
$theme = 'correct-page';
break;
but it only makes every url go to the "correct-page", not only those starting with DN98. I also tried:
case 'DN98????????':
$theme = 'correct-page';
break;
But it doesn't do anything, just makes typing that code go to the default case, also tried the same but with "*", didn't work.
Anyone might help me out? I'm not that good with PHP.
switch
does. You wantpreg_match
in anif..else
.preg_match()
: an answer here enter link description here