Forums

PHP

This topic is locked

What is PHP ?

Posted 22 Jul 2001 21:33:06
1
has voted
22 Jul 2001 21:33:06 Quinn Pearson posted:
Hi,

I'm getting very familiar with ASP and see much about PHP but no real intoduction to what it is and how it differs from ASP. I really don't know anything about PHP. Can anyone point me to a good site on the topic?

Thanks,
Quinn

Quinn Pearson
CEO - Westcoast Web Design

Replies

Replied 23 Jul 2001 01:34:35
23 Jul 2001 01:34:35 Waldo Smeets replied:
What I know about it: PHP stand for Personal Home Page. it is a fre to use server side scripting language. You can do very much the same with it as you can with ASP. Find more out about it at www.php.net

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 23 Jul 2001 14:57:26
23 Jul 2001 14:57:26 Tim Green replied:
Actually Waldo, not meaning to be pedantic here, but PHP no longer really stands for that (though it originally did).

PHP now stands for PHP Hypertext Pre-processor.

Another good site, which has an excellent link weighing up ASP and PHP and their relative pros and cons is php.weblogs.com

Tim Green
Webmaster
www.rawveg.org (Coming Soon)
Replied 23 Jul 2001 18:45:05
23 Jul 2001 18:45:05 Quinn Pearson replied:
Thanks goes to both of you. I'm sure I'll find everything I need to get started.

Just to clarify things and get the ball rolling faster, when these sites boast a new version of a PHP release, are they reffering to the software that will be run server side or is it something I need to develop sites for each of my clients?

Can the same be said for MySQL.com where they have a software release? It confuses me as well.

Thanks again,
Quinn

Quinn Pearson
CEO - Westcoast Web Design
Replied 23 Jul 2001 20:16:26
23 Jul 2001 20:16:26 Bruno Mairlot replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi,

I'm getting very familiar with ASP and see much about PHP but no real intoduction to what it is and how it differs from ASP. I really don't know anything about PHP. Can anyone point me to a good site on the topic?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Actually, PHP is very much like ASP,JSP or even Coldfusion. You design in HTML, then you insert some tag where you code some algorithms then print them on the page.

Basically the code is executed on the server then viewed on the client browser.

PHP (IMHO, no flame) is much faster,efficient and stable than ASP. I have experience with ASP and JSP, and I have noticed that developpment time is mich higher with these two languages. That's one of the reason for the success of UD : it leverage the developper work.

PHP is syntaxically very close to C and close to PERL.

Here is an example :

You've got a table definition here :
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;table&gt;

Well, if you want to place some code in your page, then place the php tag inside a <b>TD</b> like this :

&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;?php print "Hello World";?&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;table&gt;

One thing that is interesting for DW/UD user and this kind of programming, is that you have to understand that when the code is executed you have two mode : the php mode and the html mode.

When you open a php tag with <b>&lt;</b> then you are in php mode, when you're out of this tag, you're in html mode.

So imagine you're in DW, you want to list all the data of a query.

Then all you have to do is to open a php tag, use a while or a for to make a loop, then use a { char to begin the block, then you close your php tag, so you're in html mode. There you design everything you want in html, usually you'll design a table row, that will repeated.

Then you open a new php tag, inside which you just close the } block.

And you can do that for an if or anything else. As long as your code is syntaxically correct you can do whatever you want.

Replied 26 Jul 2001 16:29:49
26 Jul 2001 16:29:49 Bob Costa replied:
Another two cents...

From long time perspective, I see ASP as poorly architected, probably due to pressures on Microsoft to get somthing out for IIS. The whole "component" architecture is destined to collapse under the weight or version control and the refusal of most webmasters to install custom components on shared servers. ALso the learning curve is tedious imho.

PHP is much simpler. You can do anything in PHP. Anything. There is no need for components. It is extensible like UD. It supports OOP (which is an oops IMHO) but does not require it. You can learn to write a "hello world" in two minutes. Try that with an ASP component. It spans the *nux and Windows worlds, and has open source with perpetual improvements and a great system of version control.

When you start working in PHP, the coolest thing is how you can switch back and forth between languages even in the middle of a sentence. SO i you ar e in teh middle of an html statement, and realize you need a PHP variable (or subroutine or full blown Socket call), you just change languages and keep on going.

The following HTML/Pseudocode give and example:

&lt;TITLE&gt;UD-ZONE Welcome &lt;?php do db lookup and get username based on cookie ?&gt; We hope you are having a good day &lt;/title&gt;

The php statement could easily have been a db loop. If you replace &lt;Title&gt; with &lt;Body&gt; you could even draw a chart dynamically based on database data or user input. It lets your program as you think.

Likewise you can insert html inside of PHP

&lt;?php begin loop
get db record ?&gt;
&lt;a href="&lt;?php echo dblinkurl ?&gt;"&gt;Link Name goes here&lt;/a&gt;&lt;br&gt;
&lt;?php next loop ?&gt;

Note that you could even insert php inside of an HTML tag.

MySQL is comparable to MSSQL and Access, but each has its own drawbacks.

As far as versions, both programs have continuous releases, if you are on shared host you usually don't need to worry much about it.

Replied 26 Jul 2001 17:02:49
26 Jul 2001 17:02:49 Bruno Mairlot replied:
Just to complement your last reply, here is the code to do the 9th multiplication table :

<pre id=code><font face=courier size=2 id=code>
<b>&lt;table&gt;</b>
<b>&lt;tr&gt;</b>
<b>&lt;td&gt;</b>Row<b>&lt;/td&gt;</b>
<b>&lt;td&gt;</b>Result<b>&lt;/td&gt;</b>
<b>&lt;/tr&gt;</b>
<font color=red><b>&lt;?php</b>
for($i=0;$i&lt;10;$i++){
?&gt;</font id=red>
<b>&lt;tr&gt;</b>
<b>&lt;td&gt;</b><font color=red><b>&lt;?=$i?&gt;</b></font id=red><b>&lt;/td&gt;</b>
<b>&lt;td&gt;</b><font color=red><b>&lt;?=$i*9&gt;</b></font id=red><b>&lt;/td&gt;</b>
<b>&lt;/tr&gt;</b>
<font color=red><b>&lt;?php</b>
}
<b>?&gt;</b></font id=red>
<b>&lt;/table&gt;</b>
</font id=code></pre id=code>

Result :

<pre id=code><font face=courier size=2 id=code>
<b>&lt;table&gt;</b>
<b>&lt;tr&gt;</b>
<b>&lt;td&gt;</b>Row<b>&lt;/td&gt;</b>
<b>&lt;td&gt;</b>Result<b>&lt;/td&gt;</b>
<b>&lt;/tr&gt;</b>

<b>&lt;tr&gt;</b>
<b>&lt;td&gt;</b>0<b>&lt;/td&gt;</b>
<b>&lt;td&gt;</b>0<b>&lt;/td&gt;</b>
<b>&lt;/tr&gt;</b>
<b>&lt;tr&gt;</b>
<b>&lt;td&gt;</b>1<b>&lt;/td&gt;</b>
<b>&lt;td&gt;</b>9<b>&lt;/td&gt;</b>
<b>&lt;/tr&gt;</b>
<b>&lt;tr&gt;</b>
<b>&lt;td&gt;</b>2<b>&lt;/td&gt;</b>
<b>&lt;td&gt;</b>18<b>&lt;/td&gt;</b>
<b>&lt;/tr&gt;</b>
<b>&lt;tr&gt;</b>
<b>&lt;td&gt;</b>3<b>&lt;/td&gt;</b>
<b>&lt;td&gt;</b>27<b>&lt;/td&gt;</b>
<b>&lt;/tr&gt;</b>
<b>&lt;tr&gt;</b>
<b>&lt;td&gt;</b>4<b>&lt;/td&gt;</b>
<b>&lt;td&gt;</b>28<b>&lt;/td&gt;</b>
<b>&lt;/tr&gt;</b>
.
.
.


</font id=code></pre id=code>

This example illustrate one of my favorite feature of PHP : the two modes Galt just wrote about it.

Now you know what you have to do when you want to list a recordset.

Well, another example : Just create the same recordset in UD one in ASP the other in PHP, and you'll see the difference by yourself

And a last thing : Apache/PHP works very well on Win32 (95,98,Me,NT,2000) and it's free (as in free beer) and MySQL too, so there's no real reason, not to give PHP a try <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

"First they laugh at you, then they fight you, then you Win..." Ghandi

Reply to this topic