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

Where can I find php ini file?

0 Answers  


List some features of php that are deprecated in php

0 Answers  


Which function(s) in PHP computes the difference of arrays?

0 Answers  


What is difference between html and php?

0 Answers  


How would you declare a function that receives one parameter name hello?

0 Answers  






How to read and display a HTML source from the website url?

0 Answers  


we have two tables first one is EMPLOYEE having EmpID, EmpNAME, Second table is SALARY table having id, salary Write a query to get name of those person who having more than 10000$ salary

3 Answers   Net Solution,


can you give me an example code of calling java script function in php variable using AJAX.or with out ajax??????

0 Answers  


•How do you create subdomains using PHP?

1 Answers  


Single choice objective PHP question...

1 Answers  


Does php have multiple inheritance?

0 Answers  


Is it possible to submit a form with a dedicated button?

0 Answers  


Categories