Is there a function or way on how to get the CAPS words on a sentence or string?
Example: $str = "ABOUT US who we are"
how am i able to identify and get the capitalized words "ABOUT US"and separate it to small letter words "who we are"? So that the output would be $str1 = "ABOUT US" and $str2 = "who we are"… thanks!
Is there a function or way on how to get the CAPS words on
Share
You can use a regular expression for it:
To match the lowercase words, use this:
Then you can use functions such as
implode()to build the strings.