$s) { if ('' === $s .= '') { $s = '/^(?<=.)$/'; } else { $s = preg_quote($s, '/'); $s = strtr($s, array( 'i' => '(?-i:[iİ])', 'İ' => '(?-i:[iİ])', 'ı' => '(?-i:[ıI])', 'I' => '(?-i:[ıI])', )); $s = "/{$s}/ui"; } $search[$i] = $s; } $subject = preg_replace($search, $replace, $subject, -1, $replace); $count = $replace; return $subject; } public static function ucfirst($s) { if ('i' === substr($s, 0, 1)) { return 'İ'.substr($s, 1); } else { return parent::ucfirst($s); } } public static function ucwords($s) { if (false !== strpos($s, 'i')) { $s = preg_replace('/\bi/u', 'İ', $s); } return parent::ucwords($s); } }