Write a PHP code to print following number pattern:
123
456
789

Answer Posted / rajendra

<?php
$num = "";
for($i=1;$i<=9;$i++) {

$num .= $i;
if($i%3==0){
$num .="<br />";
}

}
echo $num;
?>

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between echo and print in php?

696


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

737


What does addslashes do in php?

729


What is $_ get in php?

782


Which function you can use in php to open a file for reading or writing or for both?

851


What is the difference between substr() and strstr()?

1118


What is the difference between == and === in php?

773


How to get ip address of clients machine?

722


What is the difference between static and dynamic websites?

707


How to get useful error messages in php?

779


What is the difference between explode and split?

698


How to run a php script?

752


What are php string functions?

730


How to open a file for reading?

762


What is the role of php?

722