| Не могу понять, в чем причина.
Вот этот код работает нормально, первая буква в верхний регистр переводится:
<?php
setlocale( LC_ALL, "ru_RU.CP1251" );
print ucfirst("прошли");
?>
|
А вот в этом коде, ucfirst не работает:
<?php
$text = @file_get_contents ("http://100realty.com.ua/news/");
if(!empty($text)) {
$text = substr($text, strpos($text, '<div id="news_lenta">'));
$text = substr($text, 0, strpos($text, '<div class="clear"> </div>'));
$text = strip_tags($text, "<a></a>");
$lf = array(" ","\r","\n","\t");
$text = str_replace($lf,"",$text);
$text = preg_replace ("#(\d{1,2}):(\d{1,2})#is", "", $text);
$str = array("января","февраля","марта","апреля","мая","июня", "июля","августа","сентября","октября","ноября","декабря",);
$num = array(".01.",".02.",".03.",".04.",".05.",".06.",".07.",".08.",".09.",".10.",".11.",".12.");
$text = str_replace($str, $num, $text);
$header = preg_match_all("#<a href=\"[^>]+\">([^<]*)<\/a>(\d{1,2})\.(\d{1,2})\.(\d{4})#si",
$text, $matches, PREG_PATTERN_ORDER);
for($j = 0;$j<count($matches[0]);$j++){
$header = $matches[0][$j] . "<br>";
setlocale( LC_ALL, "ru_RU.CP1251" );
$header = strtolower($header);
$header1 = ucfirst($header);
print $header1;
}
}
?>
|
| |