write a program to print
[123]
[456]
[789]
note : braces also need to be printed

Answers were Sorted based on User's Feedback



write a program to print [123] [456] [789] note : braces also need to be printed..

Answer / digambar kangude

$k=1;
for($i=1; $i<=3; $i++)
{
echo "[";
for($j=1;$j<=3;$j++)
{
echo $k;
$k++;
}
echo "]";
}

Is This Answer Correct ?    14 Yes 3 No

write a program to print [123] [456] [789] note : braces also need to be printed..

Answer / sumit manchanda

<?php
$count=0;
echo "[";
for($i=1;$i<10;$i++){

if($i%3==0){
echo "$i";
echo "]";
echo "</br>";
$count++;
}else{
if($count==3){
echo "[";
$count=0;
}
$count=$count+1;
echo "$i";

}
}

?>

Is This Answer Correct ?    11 Yes 1 No

Post New Answer

More PHP Interview Questions

How can I rotate an image?

1 Answers   Rushmore Consultancy,


how can we check mail function with '127.0.0.1' (before submitting a site?

1 Answers  


Explain mysql_errno()?

0 Answers  


How do I clear my browser session?

0 Answers  


How data or variable can be receive or send from PHP to HTML page??

3 Answers   TCS,






Why triggers are used in mysql?

0 Answers  


What is $_ env in php?

0 Answers  


programm for factorial

1 Answers  


Tell me what is the difference between exception::getmessage and exception::getline?

0 Answers  


Why do we use csrf token?

0 Answers  


Which php framework is in demand?

0 Answers  


Declare a new variable in php equal to the number 3;

0 Answers  


Categories