write a program to print
[123]
[456]
[789]
note : braces also need to be printed
Answer Posted / 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 View All Answers
What is php addslashes?
How is session data stored?
What is the special meaning of __sleep and __wakeup?
What does mvc stand for and what does each component do?
What is $_ request in php?
How does php work?
Which function would you use to read a line of data from a file in php?
Explain about the data types in PHP?
What kind of things have you done on the social side?
What is strstr php?
What is new static in php?
What is smarty?
Inside a php function, what param needs to be set in order to access a global variable?
When a conditional statement is ended with an endif?
What software is required for php?