PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 15: Write a PHP program which will count the "d" characters in the text "tutorial.duniya".


<!DOCTYPE html>
	<title>PHP Programs</title>
		$text = "tutorial.duniya";
		$search_char ="d" ;
		$count ="0";

		for ($num=0; $num <strlen($text) ; $num++) 
			if(substr($text ,$num ,1)==$search_char)
				$count =$count+1;
		echo  $count ."\n";

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.