I have two types of strings, hello and helloThere.
What I want is to change them so they read like: Hello and Hello There depending on the case.
What would be a good way of doing this?
Advertisement
Answer
you can use ucwords like everyone said… to add the space in helloThere you can do $with_space = preg_replace('/[A-Z]/'," $0",$string); then ucwords($with_space);