Forum Doku Wiki Blog

Forumsarchiv 2007, Mai
Count-Match-?

archivierte Beiträge lesen

  1. (PHP) Count-Match-? von xara, 14. 05. 2007, 18:49

Count-Match-?

Der folgende Beitrag wurde am 14. 05. 2007, 18:49 Uhr von xara veröffentlicht.

hallo,

<?
$string = "Ich möchte wissen wie oft ich das wort ich diesem string habe";

$check = "ich";

#funktion?
# return = 3
?>

wie mache ich das? ;)
- Groß und klein egal

noch ein bsp:
<?
$string = "12345678912345678";

$check = "9";

#funktion?
# return = 1
?>

Danke!!

substr_count()

Der folgende Beitrag wurde am 14. 05. 2007, 19:03 Uhr von Vinzenz Mai veröffentlicht.

Hallo

> $string = "Ich möchte wissen wie oft ich das wort ich diesem string habe";
>
> $check = "ich";
>
> #funktion?
> # return = 3

hast Du Dir schon einmal substr_count() angeschaut?

Frage: Was sollte bei


$string = 'Wichtig: Ich möchte wissen wie oft ich das wort ich diesem string habe';
$check = 'ich';


als Ergebnis herauskommen?


Freundliche Grüße

Vinzenz

© 1998-2013 SELFHTMLImpressumSoftware: Classic Forum 3.4