Necesito saber el número de veces que aparece un criterio en un texto, ambos valores los metro por un for,
<?php
echo "<form action=final.php method=post><input type=text name=texto><br><input type=submit></form>";
echo "<form action=final.php method=post><input type=text name=criterio><br><input type=submit></form>";
echo substr_count("$texto", "$criterio");
?>
pero no funciona, alguien me hecha una mano? he buscado por el foro pero no encuentro la solucón.
Un saludo.