php - How do I convert parts of the string to uppercase? -


I have a string that I want to convert to uppercase besides the word 'and' which would always be surrounded by underscores is. / P>

then it becomes me_and_you ME_and_YOU does not always contain 'and' in the string, so it can be you me_you ME_YOU

Obviously strtoupper () makes the whole thing uppercase Do I have to use something like preg_split () or explosion ()?

You could probably write a regex to do this, but there would be an easy solution solution:

  echo str_replace ('_ AND_', '_and_', strtoupper ($ your_string));    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -