PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$string = "this is the string i want to capitalise the first letter of each word on";
function upper($string) {
$storage = array();
$words = explode(" ", $string);
foreach ($words as $test) {
$storage[] = strtoupper(substr($test, 1));
}
print_r($storage);
}
upper($string);
But this is my unwanted output:
Array
(
[0] => HIS
[1] => S
[2] => HE
[3] => TRING
[4] =>
[5] => ANT
[6] => O
[7] => APITALISE
[8] => HE
[9] => IRST
[10] => ETTER
[11] => F
[12] => ACH
[13] => ORD
[14] => N
)
They usually are. If you search years ago for my older posts you might come across one where I spent about 45 lines of code attempting to fetch the name portion of the current file that I was in.
We come here to learn. You learned. We are both golden.
I would venture to say that almost everything that we want to do with data manipulation, numerics and files, has already been done either in the core or by someone. The PHP team, although making this a bit inconsistent with the core functions, has included quite an array of functionality in the core.