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 session expiry?
What is get method in java?
How to convert strings to numbers in php?
Which is useful for method overloading?
Which methods should be used for sending an email using the variables $to, $subject, and $body?
What is difference between print and echo in php?
Tell me are parent constructors called implicitly inside a class constructor?
How do I escape data before storing it into the database?
Can you convert php to html?
For image work which library is used in php?
In php, how to redirect from one page to another page?
Declare a new variable in php equal to the number 3;
What is encapsulation in php?
Which function Returns the time of sunrise for a given day / location in PHP.
What is the difference between laravel and php?