Kjapp og trygg hosting for Wordpress

store / små bokstaver php

kongen

kongemedlem
Hvis man har variablen $by og ønsker at den skal formateres til "normal tekst", hvordan gjøres dette?

PHP:
$by = "MO I RANA";
$by = "mo i rana";
$by = "Mo I Rana";

Alle disse skal bli til: $by = "Mo i Rana";
 

clinton4

Medlem
PHP:
<?php

$by = "MO I RANA"; 
$by = "mo i rana"; 
$by = "Mo I Rana"; 

$by =  ucwords($by); // Mo I Rana

$by = str_replace(' I ', ' i ', $by); // Mo i Rana

?>
 
Topp