Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Does php 7 support mysql?

1047


How many escape sequences are recognized in double-quoted strings?

1048


Xplain is it possible to use com component in php?

998


What is the difference server side and browser side validation?

1065


How does php server work?

1081


How to convert a string to lowercase in php?

1099


What is the use of strip_tags() method?

992


Write a select query that will be displayed the duplicated site name and how many times it is duplicated?

1081


What is the sign to start variables in PHP?

1160


how retrive the video file in php using video tag

1826


Write a program to upload a file in php?

1066


What is the use of $_server and $_env?

1114


What is faster?

1072


Explain what is memcache?

1037


Explain the value of the variable input is a string 1,2,3,4,5,6,7. How would you get the sum of the integers contained inside input?

1029