Write a PHP code to print following number pattern:
123
456
789

Answers were Sorted based on User's Feedback



Write a PHP code to print following number pattern: 123 456 789..

Answer / sheetal

<?php
$k=1;
while($k<9)
{
for($i=1;$i<=3;$i++)
{
echo $k;
$k++;
}
echo "</br>";
}
?>

Is This Answer Correct ?    7 Yes 0 No

Write a PHP code to print following number pattern: 123 456 789..

Answer / akashumate

<? php

$i=1;

while($i<=3)
{
echo $i;
$i++;
}
echo "<br>" ;
$j=$i;
while($j<=6)
{
echo $j;
$j++;
}
echo "<br>" ;

$k=$j;
while ($k<=9)
{
echo $k;
$k++;
}
echo "<br>" ;

? >

Is This Answer Correct ?    2 Yes 1 No

Write a PHP code to print following number pattern: 123 456 789..

Answer / sam

<?php
$num = "";
for($i = 1; $i<=9; $i++ )
{
if($i%3 == 1)
{
echo "<br />";
}
echo $i;
}
?>

Is This Answer Correct ?    2 Yes 1 No

Write a PHP code to print following number pattern: 123 456 789..

Answer / ronak sharma

<?php
$count=0;
for($i=1;$i<=3;$i++)
{
for($j=1;$j<=3;$j++)
{
$count++;
echo $count;
}

echo "<br>";
}

?>

Is This Answer Correct ?    1 Yes 0 No

Write a PHP code to print following number pattern: 123 456 789..

Answer / rajendra

<?php
$num = "";
for($i=1;$i<=9;$i++) {

$num .= $i;
if($i%3==0){
$num .="<br />";
}

}
echo $num;
?>

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More PHP Interview Questions

what is mean php ? is it designingtool or language? how ill create website using by php?

1 Answers  


•What is the difference between “mysql_fetch_array” and “mysql_fetch_object?

2 Answers   Infotech,


What is meant by urlencode and urldecode?

0 Answers  


What is stripslashes php?

0 Answers  


How to make a file encrypt and decrypt?

4 Answers   3i Infotech,






How can we determine whether a php variable is an instantiated object of a certain class?

0 Answers  


Explain how is it possible to set an infinite execution time for php script?

0 Answers  


Does php 5 support exceptions?

0 Answers  


What is the difference between file_get_contents() and file_put_contents() in php?

0 Answers  


What is MVC structure in Magento?

4 Answers  


What is the difference between static and dynamic websites?

0 Answers  


What is composer install?

0 Answers  


Categories