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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What function do we use to find length of string, and length of array?

533


Can we override static method in php?

537


How to split a string into array using php?

550


Explain the difference between isset() and empty()?

540


Do you know how can we check the value of a given variable is a number?

522






What is the use of strpos in php?

559


Tell me what type of operation is needed when passing values through a form or an url?

540


How to delete a file from the system?

572


How to create a session? How to set a value in session?

522


Which php global variable is used for uploading a file?

510


What are the functions of string?

526


how can i develop forum code? any one pleale help me on this question

1525


Tell me how comparison of objects is done in php5?

517


What are different types of Print Functions available in PHP?

530


What is the best way to test the strpos() return value in php?

534