xara: Count-Match-?

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!!

  1. 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