Page 1 of 1

Posted: Tue Apr 22, 2003 5:16 pm
by liquedus
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.

Posted: Wed Apr 23, 2003 3:25 am
by pootergeist
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.

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

Posted: Tue Apr 29, 2003 2:43 am
by Redcircle
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.

Posted: Wed Apr 30, 2003 1:29 am
by leon
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...

Posted: Wed Apr 30, 2003 7:10 pm
by *JaH*
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 :)

Posted: Wed May 07, 2003 1:07 pm
by Godiwa
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

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

Posted: Thu May 08, 2003 1:42 am
by WiZARD
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)...