Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Do While Loop Examples in PHP

Do While Loop Examples in PHP

In this tutorial, we will learn “do while loop program in PHP”.

Code of program”do while program in PHP”

    <form action="" method="post">
        <input type="text" name="string" />
        <input type="submit" />
        $string = strtolower($_POST['string']);
        $vowels = array('a','e','i','o','u');
        $len = strlen($string);
        $num = 0;
            if(in_array($string[$i], $vowels))
		while( $i<$len);
			 		function countDigits( $string )
    return preg_match_all( "/[0-9]/", $string );
substr_count($string, ' ');

        echo "Number of vowels : <span>". $num."</span>";
		echo "<br>";
		echo "Number of digits :".countDigits($string);
		echo "<br>";
		echo "Number of spaces :" . substr_count($string," ");

The output of code of “do while program in PHP”

do while program in PHP

Figure: Output of Do while loop example in PHP

Fazal Rehman Shamil Click Here to Know More
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325
Dear Professors and Resarchers!You are welome to Cite these tutorials in your research or slides etc. Please don't forget to mention the reference of website. Copy Paste of text is strcitly forbidden. Images can be reuse because images are protected with watermark.