note 79956 added to function.strtoupper

From: Date: Fri, 21 Dec 2007 02:16:59 +0000
Subject: note 79956 added to function.strtoupper
Groups: php.notes 
Request: Send a blank email to php-notes+get-133829@lists.php.net to get a copy of this message
Here the code to upper every first character in a string: $str = 'this is a long small string'; if (strlen($str) > 1) // str longer than one char? for ($i = 1; $i < strlen($str)-1; $i++) // loop all char if ($str[$i-1] == ' ') // is the char before a space? $str[$i] = strtoupper($str[$i]); // if true, upper it echo ucfirst($str); // at last upper the first char // Result = 'This Is A Long Small String' ---- Server IP: 217.160.72.57 Probable Submitter: 87.123.86.145 ---- Manual Page -- http://www.php.net/manual/en/function.strtoupper.php Edit -- https://master.php.net/note/edit/79956 Del: integrated -- https://master.php.net/note/delete/79956/integrated Del: useless -- https://master.php.net/note/delete/79956/useless Del: bad code -- https://master.php.net/note/delete/79956/bad+code Del: spam -- https://master.php.net/note/delete/79956/spam Del: non-english -- https://master.php.net/note/delete/79956/non-english Del: in docs -- https://master.php.net/note/delete/79956/in+docs Del: other reasons-- https://master.php.net/note/delete/79956 Reject -- https://master.php.net/note/reject/79956 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#133829) next »