note 92584 modified in function.ucfirst by thiago

From: Date: Thu, 30 Jul 2009 12:05:13 +0000
Subject: note 92584 modified in function.ucfirst by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-158910@lists.php.net to get a copy of this message
Simple function for use ucfirst with utf-8 encoded cyrylic text <?php public function capitalize_first($str) { $line = iconv("UTF-8", "Windows-1251", $str); // convert to windows-1251 $line = ucfirst($line); $line = iconv("Windows-1251", "UTF-8", $line); // convert back to utf-8 return $line; } ?> --was-- Simple function for use ucfirst with utf-8 encoded cyrylic text public function capitalize_first($str) { $line = iconv("UTF-8", "Windows-1251", $str); // convert to windows-1251 $line = ucfirst($line); $line = iconv("Windows-1251", "UTF-8", $line); // convert back to utf-8 return $line; } http://php.net/manual/en/function.ucfirst.php

« previous php.notes (#158910) next »