How can be check whether link we added is follow or dofollow

<?php
function demo($a,$b)
  {
$haystack = file_get_contents($a);
$url=$b;
$needle = '<a href="'.$url.'" rel="nofollow">Austin Grocery Home Delivery</a>';
$d=stristr($haystack,$needle);

 /*if($d=stristr($haystack,$needle) != FALSE )
 {
echo "$d";
}
else
{
echo "$d";
}
*/

if($d>0)
 {
 echo "noffolow";
 }
   else
   {
   echo "dofollow";
   }


}

if(isset($_POST['submit']))
  {
  $url=$_POST['a'];
  $url1=$_POST['b'];

  $url=rtrim($url,'/');
  $url1=rtrim($url1,'/');
  //echo "$url $url1" ;
  echo demo($url,$url1);

  }

?>
<form action="" method="post">
A<input type="text" name="a" />
B<input type="text" name="b" />

<input type="submit" name="submit" value="submit" />
</form>

I don’t understand. What is your problem with this code?

actually i am checking the link that i added suppose in A field i have input the
cms-directory.com/story.php?title=austin-grocery-home-delivery#bbNews-comments
and in B textfield i have input the
burpy.com/.
then the output will be nofollow . but its showing dofollow. how can i check the link is added
burpy.com in cms-directory.com/story.php?title=austin-grocery-home-delivery#bbNews-comments is nofollow or dofollow.

Before you commented out

/*if($d=stristr($haystack,$needle) != FALSE )
 {
echo "$d";
}
else
{
echo "$d";
}
*/

Was $d > 0 ?

Actually the problem is that output will be no follow if i input the above mention link but its always showing dofollow.

http://php.net/manual/en/function.stristr.php

  1. stristr confronts two strings
  2. if the needle isn’t found, then it returns FALSE (not 0). You might want to check out example #2

Thanx for help