Q:

How to force characters to be in a certain Upper or lower case sensitive format?

I have a simple search bar for a user to search any name in a database.
$name = $_POST['name'];

And so whenever a user inputs the name I output
<h1> You have searched <?php print( "$name" )?>'s name</h1>

What I need is that for example if a user types, "leOnARD" for some reason, I would like it to come out as "Leonard" rather than "leOnARD".

A:

ucfirst() with strtolower() seems to be what you are looking for.
echo ucfirst(strtolower("leOnARD")); // prints Leonard

