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 style='color:green; font-weight:bold;'>". $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
Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.