Nested Loops with Different max values in PHP
Notes:
PHP Nested Loops :
- If required we can place one loop inside another loop; which is called as nesting of loops.
Case 2: loops with different max values
for($i=0; $i<n; $i++)
{
for($j=0; $j<m; j++)
{
sequence of statement(s); // n x m times
}
}
Ex:
for($i=0; $i<2; $i++)
{
for($j=0; $j<3; $j++)
{
echo "Hello World”,”<br/>"; // 2 x 3 = 6 times
}
}
Interview Questions:
1. PHP stands for ______________
a. Hypertext Preprocessor
b. Preprocessor Hypertext
c. Personal Home Processor
d. Personal Hypertext processor
Ans: a