Welcome, Guest. Please login or register.

Author Topic: PHP question..  (Read 3133 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: PHP question..
« on: July 12, 2005, 04:53:48 AM »
That would be

"> .....
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: PHP question..
« Reply #1 on: July 12, 2005, 06:10:55 AM »
Quote

TheMagicM wrote:
doh!  I knew it had to be simple.. I was trying to embed html into PHP and tha wouldnt work.. but php in html... (and I'm already doing that in the submit button..geez.. its getting late)  ... Thanks!!


Actually the following

print(" .... ");

would be fine too. I seem to recall, however, that the first method is supposed to be slightly faster.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: PHP question..
« Reply #2 on: July 12, 2005, 08:29:57 AM »
Quote

ExtremeWays wrote:
Or to be even cooler..


"> .....

:)


True, but I prefer readability over terseness. Unless it's C of course ;-)
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: PHP question..
« Reply #3 on: July 12, 2005, 10:18:41 AM »
Quote

Waccoon wrote:

Also, the "echo" command is faster than "print" for some reason.


Can't say I've ever noticed. I'd expect it to be a bit faster than printf() maybe :-)

Either way I don't imagine the difference would be something you'd need to worry about unless printing thousands of items ;-)
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: PHP question..
« Reply #4 on: July 12, 2005, 04:00:04 PM »
You can use a C style printf() in PHP too, if that helps ;-)

eg

printf("%s", $filename, $title);
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: PHP question..
« Reply #5 on: July 12, 2005, 04:39:15 PM »
Why not use a table with as many columns as you need and align the cells, creating a row for each record?

That's pretty much the normal way of doing these things (or you could use div based spacing if you don't like tables)
int p; // A