Hi. I hope someone can help me here. I'm sure it's an easy solution but I cant figure it out right now. Basically the code below returns False if the $user id does not start with '2' and have 5 characters. So, 20000 is true for example. if (strpos($user, '2') !== 0 && strlen($user) == 5) { return false; } else { return true; } } PHP: Now, how can I make it return False if $user id does not start with either '1' or '2', or '3' and is 5 characters long?
Sorry I don't really follow. I want it to return false if $user does not start with either 1, 2, or 3 and is 5 chars long. So, 1XXXX, 2XXXX, 3XXXX would return true for example, otherwise it should be false.
I suppose if you want anything between 10,000 and 39,999 (or with letters i suppose, but just for clarity) to return true, try: if (in_array($user{0}, array(1,2,3)) && strlen($user) == 5) { return true; } else { return false; } PHP: