I can't stress this enough: use the yoda condition
if(true == $var)
or even:
if(CONSTANT == $VARIABLE)
but not
if($VARIABLE == CONSTANT)
PHP would tell you what went wrong in this case - no matter how tired you are.
Looking for this mistake (this happens to the best of the best too) is disappointing.
Let the tool (PHP) support you, don't make it work against you.
. , :
<?php
$array = "hEllo woRlD";
var_dump(ucwords(strtolower($array)));