Dennis: RegExp.: erster Buchstabe groß

Beitrag lesen

Hi Candid,

$string = preg_replace('/([-_\\/ ]|^)([a-z])/ei', 'strtoupper(\'$1$2\')', $string);

Warum schließt du $1 in strtoupper ein?

*gähn* Soll ich dich jetzt noch mal ganz frech bitten, das was du geschrieben hast noch mal zu überdenken? ;-)

$string = "hallo candid, geht das? ja/nein";  
echo $string;  
  
$string = preg_replace('/([_\\/ \-]|^)([a-z])/ei', 'strtoupper(\'$2\')', $string);  
echo $string;  
  
/* Ausgabe:  
     hallo candid, geht das? ja/nein  
     HalloCandid,GehtDas?JaNein  
*/

MfG, Dennis.

--
Mein SelfCode: ie:{ fl:( br:> va:) ls:[ fo:) rl:( n4:# ss:) de:] js:| ch:{ sh:| mo:} zu:|
That's life - Es gibt im Leben[tm] keine Zurück-Taste. (Fabian Transchel)