Write a PHP code to print following number pattern:
123
456
789
Answers were Sorted based on User's Feedback
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 |
<? 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 |
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 |
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 |
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 |
What is php explain?
How cookies are trported from browsers to servers?
What are escaping characters? Explain with an example?
How to execute an sql query?
I finished my degree 4 years back. I didnt get job in software. In the time(for 4 years) i worked one kpo industries. but now i got job in php(40 employes working there) as fresher(Salary 8000). Shall i join in php. I have no knowledge about php. Can i do well in php. How will my carrier if i join in php? Please can you give your idea.? It will be more usefull to me.
Explain the three different kinds of Arrays?
What is php session id?
Explain Traits in PHP?
Can we use include ("xyz.php") two times in a php page "index.php"?
What is exception in php?
Is strcmp case sensitive?
What is the use of explode() function?