strpos()
Posté : 17 août 2011, 13:53
Bonjour,
j'ai un problème avec strpos()
ici la fonction qui marche nickel:
Ici la mienne qui ne marche pas
j'ai un problème avec strpos()
ici la fonction qui marche nickel:
<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
if ($pos === false) {
echo "La chaîne '$findme' n'a pas été trouvée dans la chaîne '$mystring'";
} else {
echo "La chaîne '$findme' a été trouvée dans la chaîne '$mystring'";
}
?>
Ici la mienne qui ne marche pas
$url = 'http://www.google.fr';
$http_page = file_get_contents($url);
$http_page_ = htmlspecialchars($http_page);
$findme = ('<a href="http://www.google.fr');
$pos = strpos($http_page_, $findme);
if ($pos === false) {
echo "The string '$findme' was not found'";
} else {
echo "The string '$findme' was found '";
echo " and exists at position $pos";
}
une idée?