Page 1 of 1

Need code for the following Output

Posted: Thu Aug 02, 2007 3:15 am
by vinoth
hi all

I am Vinoth
New to PHP Programming.
I want the PHP code to display the following dot output

. .
. .
. . . . .
. .
. .


first,second,fourth & fifth row contains two dots
Middle row contains 5 dots..

Is there any possible to display this output using PHP

Thanks in advance :!:

Posted: Thu Aug 02, 2007 3:20 am
by Gente
And what is the problem? What have you tried? :wink:

Posted: Thu Aug 02, 2007 3:22 am
by vinoth
I have no idea for this.

If you have any logic to print this output
All dots should be in center

Posted: Thu Aug 02, 2007 3:25 am
by Gente

Code: Select all

<?php
echo ".."."<br/>";
echo ".."."<br/>";
echo "....."."<br/>";
echo ".."."<br/>";
echo ".."."<br/>";
?>

Posted: Thu Aug 02, 2007 3:28 am
by vinoth
we should not print like this

Our code should be generalise

it should be furthur added by two dots at the beginning and end.

I want an generalise code for that

Posted: Thu Aug 02, 2007 3:48 am
by Gente
???

Code: Select all

<?php
function my_out($str)
{
  echo ".."."<br/>";
  echo ".."."<br/>";
  echo $str."<br/>";
  echo ".."."<br/>";
  echo ".."."<br/>";
}
my_out('.....');
?>

Posted: Thu Aug 02, 2007 4:00 am
by onion2k
vinoth wrote:we should not print like this

Our code should be generalise

it should be furthur added by two dots at the beginning and end.

I want an generalise code for that
Unless you can explain what you need to do in a way that's not ambiguous then noone is going to be able to help you. What you've said here doesn't explain what the problem is.