dinoslikeroar Posted September 27, 2018 Share Posted September 27, 2018 I need to convert variable being matched to uppercase and preg_match for the value in the case statement. I'm not sure what exactly I am missing. { $x = ucfirst($value); switch ($x) { case 'Urine'; if(preg_match('/(urine)(URINE)(Urine)/', $x)) { return 'UR'; } } } Link to comment Share on other sites More sharing options...
cyberRobot Posted September 27, 2018 Share Posted September 27, 2018 You could use a case-insensitive match. The first example in the PHP manual shows you how.http://php.net/manual/en/function.preg-match.php Note: with a case-insensitive match, you can remove the switch statement and the call to ucfirst(). Link to comment Share on other sites More sharing options...
benanamen Posted September 27, 2018 Share Posted September 27, 2018 OP, tell us what the real problem you are trying to solve is instead of your attempt at solving it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.