note 112329 rejected from function.ucfirst by danbrown

From: Date: Wed, 05 Jun 2013 17:38:26 +0000
Subject: note 112329 rejected from function.ucfirst by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-195057@lists.php.net to get a copy of this message
Note Submitter: andrewvideo at yahoo dot co dot uk ---- This function works great for me. But How would I make so it don't mess anything inside a html tags with urls. Its messing around with url's, its putting spaces in. Can any help. Just a waring. I only know basic php. :) function ucsentence ($string){ $string = explode ('.', $string); $count = count ($string); for ($i = 0; $i < $count; $i++){ $string[$i] = ucfirst (trim ($string[$i])); if ($i > 0){ if ((ord($string[$i]{0})<48) || (ord($string[$i]{0})>57)) { $string[$i] = ' ' . $string[$i]; } } } $string = implode ('.', $string); return $string; }

« previous php.notes (#195057) next »