write a program to print
[123]
[456]
[789]
note : braces also need to be printed



write a program to print [123] [456] [789] note : braces also need to be printed..

Answer / soujj

$countr = 0;
for($i=1;$i<=9;$i++)
{
$countr++;
$str[] = $i;
if($countr % 3 == 0)
{
echo "[";
for($j=0;$j<=2;$j++)
{
echo $str[$j];
}
echo "]";
$str=array();
}
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

What is fetch array in php?

0 Answers  


equivalent code for the following c program in php void main() { int i=5;printf("%d",i); }

2 Answers  


How can we automatically escape incoming data?

0 Answers  


What is encapsulation in php?

0 Answers  


Why do we need abstract class in php?

0 Answers  






List some string function name in php?

0 Answers  


How to define a user function?

0 Answers  


How many different types of messages available in php?

0 Answers  


What is class extend in php?

0 Answers  


When to use get and post request?

0 Answers  


What is a trait in php?

0 Answers  


Can we override static method in php?

0 Answers  


Categories