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


Please Help Members By Posting Answers For Below Questions

What are the different tables(engine) present in mysql, which one is default?

508


Tell me what is htaccess?

487


How do I run a php file?

510


What is the use of rand() in php?

603


Explain the difference b/w static and dynamic websites?

494






How to strip whitespace (or other characters) from the beginning and end of a string?

468


What is stdclass in php?

544


Explain what are psrs? Choose 1 and briefly describe it?

509


Where is session value stored php?

533


Tell me what is the difference between get and post?

473


Which library is used in php to do various types of image work?

513


Write down the code for save an uploaded file using php?

450


What is the difference server side and browser side validation?

483


What does pear stand for?

534


Why do we use csrf token?

513