How popular is PHP? And a real question...

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
liquedus
php-forum Active User
php-forum Active User
Posts: 264
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada
Contact:

Tue Apr 22, 2003 5:16 pm

like java? 8O wow..... anyways since php is done server side and only html is sent to client, i guess it would depend on which one generates the file faster.

pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Wed Apr 23, 2003 3:25 am

it is slightly faster to drop out from php and hardcode the html - though using single quoted concatenated strings on your first example would also increase the speed (the php parser doesn't interpret single quoted strings so echo 'text $var text' would result in 'text $var text' whereas "text $var text" would give "text value text"

echo '<tr><td>' .$row["firstname"]. '</td><td>' .$row["lastname"];

as to PHP usage globally - it is the #1 module used on Apache server which is obviously the #1 server (3.1 million servers run PHP - http://www.securityspace.com/s_survey/d ... emods.html ) - even !yahoo (the worlds biggest site) has recently swapped from its proprietary !y1 and !y2 languages to begin using PHP as its main language.
avatar image based upon nasas apod (only updates if I post though)

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Tue Apr 29, 2003 2:43 am

gcm2 wrote:Also - when reading in data (like from a database) and populating an HTML table, is it better to echo a bunch of html and php stuff, or drop out of a php block and do "pure" html with php snippets embedded?

Examples:

php block

<?php
while ($row = mysql_fetch_assoc($result)) {
echo "<tr><td>";
echo $row["firstname"];
echo "</td><td>";
echo $row["lastname"];
... and so on

drop out to html block

<?php
while ($row = mysql_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $row["firstname"]; ?>
</td>
<td><?php echo $row["lastname"]; ?>
</td>
... and so on


Thanks. :)


well using the bottom one would be faster. But it all depends on the programmer on which they prefer to use. Some consider it sloppy to use the bottom method. I prefer to use the single quote method that pootergeist suggested.

And for PHP popularity I tried JSP a few years ago and no servers hosted it well.. no cheap servers did anyways.. So I went with PHP. Now JSP is the new Enterprise Fad. Too bad I'm not programming for enterprises. It's amazing how far PHP has come in 3 years. I throught it was awesome when I stumbled on it now I don't know how I would live without it. heck I even have dreams about it.

User avatar
leon
New php-forum User
New php-forum User
Posts: 36
Joined: Sat Aug 03, 2002 11:54 am

Wed Apr 30, 2003 1:29 am

how is popular php ?

look http://www.hotscripts.com the number of php scripts
compared with perl ..

1 years ago php scripts on hotscripts were below 3000
and 2 years below 1000 .. now they surpassed at the speed of light perl scripts ..... which are stable around 3500/4500 scripts in the last 2 years (!)

Looking hotscripts perl popularity is not growing/stable while php popularity is growing really fastttt in last years...

*JaH*
New php-forum User
New php-forum User
Posts: 80
Joined: Fri Jan 31, 2003 4:18 pm

Wed Apr 30, 2003 7:10 pm

another way to echo a big pile of html code is like this:

Code: Select all

print <<<END 
<html>
  <head>
    <title>My Template</title>
  </head>
  <body>
    $gBODY
  </body>
</html>
END;


but most programmers seperate the html from the phpscript, that way the designer doesn't need to be a php-expert :)

Godiwa
New php-forum User
New php-forum User
Posts: 40
Joined: Wed Mar 05, 2003 5:55 am

Wed May 07, 2003 1:07 pm

another thing is to simply do an INCLUDE drag in all the html you want and if you have any Vars you want printed out on the page for the users then use <%=$var%> good luck with it, use it often in my code especially for forms and such.

Godiwa

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Thu May 08, 2003 1:42 am

Hi
info about poputarity PHP in internet you may see at http://www.php.net/usage.php
by the way Java it's very interesting solution for intranet not for internet, cause for Java need very perfomaced computer(Server)...
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

Post Reply