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

Explain php explode() function.

0 Answers  


Is it possible to submit a form with a dedicated button?

0 Answers  


How values in arrays are indexed?

0 Answers  


How many ways we can give the output to a browser?

6 Answers  


How to find current date and time?

0 Answers  






Is echo a function in php?

0 Answers  


What are php string functions?

0 Answers  


hello experts good morning to everyone ! at present am now learning LAMP course sir( linux, apache,mysql and php) after finishing this course can i create my own website without investment is it possible ? please can any one tell sir and also tell me how can i upload my project after finishing the project in internet ? please tell the ways sir please send ur valuable suggestions to kiranpulsar2007@gmail.com

2 Answers  


What is php session id?

0 Answers  


What is the main difference between require() and include()?

0 Answers  


Name the Functions in IMAP, POP3 AND LDAP?

2 Answers  


What are the difference between abstract class and interface?

4 Answers  


Categories