PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm not sure why array_search is acting up. I just tried in_array($a,$c) and that worked fine.
Your number two is broken because you are using an unescaped dollarsign in the doubly quote string. Either escape the dollar sign or change to single quotes.
On number 2, haven't you flipped your '$' and '^'? Isn't '^' beginning of string and '$' end of string? So of course it doesn't match as it is impossible to match something that specifies the end of string before the beginning of string.