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

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

How to redirect https to http url and vice versa in .htaccess?

0 Answers  


what is array_search() in php?

2 Answers  


What does the initials of php stand for?

0 Answers  


Why php script is not running in browser?

0 Answers  


What is The difference between ' and " where they can ben in between or outmost and how

2 Answers   Avis Software,


What does the unlink() function means?

0 Answers  


Where are php configuration settings stored?

0 Answers  


Can we override magic methods in php?

0 Answers  


Are static variables final?

0 Answers  


What is the purpose of basename() function in PHP?

0 Answers  


What is the meaning of curl , which is used while connecting with pay pal? and how it works?

2 Answers  


What is the use of header in php?

0 Answers  


Categories