1 Lip 2010

Zamiana pierwszych liter w wyrazach na duże

$w_city = 'mapa biala podlaska';
$w_city_t = explode(' ',$w_city);
$w_city_t = array_map('ucfirst' ,$w_city_t);
$w_city = implode(' ', $w_city_t);
echo $w_city;

Mapa Biala Podlaska

$w_city = 'mapa bielsko-biala';
$w_city_t = preg_split('/[ -]+/',$w_city);
$w_city_t = array_map('ucfirst' ,$w_city_t);
$w_city = implode(' ', $w_city_t);
echo $w_city;

Mapa Bielsko Biala

$w_city = 'mapa bielsko-biala';
$w_city = ucwords($w_city);
$w_city = implode('-', array_map('ucfirst' , explode('-',$w_city)));
echo $w_city;

Mapa Bielsko-Biala