Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $nome = "nerd";
- $stringa = $_REQUEST['frase'];
- if(array_key_exists('frase', $_REQUEST)){
- $stringa=$_REQUEST['frase'];
- $dim = strlen($stringa);
- $stringa = str_replace(".", " ", $stringa);
- $stringa = str_replace(",", " ", $stringa);
- $sep = explode(" ",$stringa);
- $dim = count($sep);
- $volte = 0;
- for ($i = 0; $i < $dim; $i++)
- {
- if (!strcmp($nome,$sep[$i])) $volte++;
- }
- echo "Ci sono [$volte] $nome nella frase [$stringa]";}
- ?>
Add Comment
Please, Sign In to add comment