php and html ?

paulmofyourhand

[H]ard|Gawd
Joined
Mar 26, 2002
Messages
1,331
Can somebody tell me what are the benefits of using PHP and HTML?

just a quick or through overview would be greatly appreciated
 
Taken from http://php.net
What is PHP?

PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

Simple answer, but what does that mean? An example:
Code:
Example 1-1. An introductory example
<html>
   <head>
       <title>Example</title>
   </head>
   <body>

       <?php
       echo "Hi, I'm a PHP script!";
       ?>

   </body>
</html>

Notice how this is different from a script written in other languages like Perl or C -- instead of writing a program with lots of commands to output HTML, you write an HTML script with some embedded code to do something (in this case, output some text). The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode".

What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server. If you were to have a script similar to the above on your server, the client would receive the results of running that script, with no way of determining what the underlying code may be. You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve.

The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer. Don't be afraid reading the long list of PHP's features. You can jump in, in a short time, and start writing simple scripts in a few hours.

Although PHP's development is focused on server-side scripting, you can do much more with it. Read on, and see more in the What can PHP do? section, or go right to the introductory tutorial if you are only interested in web programming.

Personally, I like PHP for its ease of use, minimal redundant coding, especially in smaller projects, and its tight integration with HTML. I can build an app quickly and integrate it with existing HTML, without having the need for the script to handle data processing as well as the layout. Its open source, and integrates with MySQL well. Its fast, and eliminates a lot of redundant coding on my part through the use of builtin functions and libraries. Best of all, it uses a C style syntax.

My language of choice :)
 
i can sum it up in three words - Dynamically Generated Webpages.

what does that mean?

well, how does having a page that shows different information depending on the user's preferences? How about a page that automatically displays the most up to date information pulled directly from a database? or how about running a weblog where you can enter your updates via a webpage that you can access from any computer connected to the Internet anywhere in the world?

that'sjust the tip of the iceberg in terms of the power of PHP (and other scripting languages)..
 
A slightly more powerful example than maw's would be this forum. Note how every thread is .../showthread.php... with the content varied by the parameters passed in (thread id and the like for database reference).

Other than that, I don't have a whole lot to add. PHP is remarkably friendly in its scaling complexity (sorta like M11 noted). You can have very simple one-shot data deals (like inserting the current time) all the way through object-oriented partially-compiled projects. It doesn't quite match ASP.NET on that score, but it's still not bad.

Easy setup of a free webserver software suite (Linux + Apache + PHP + MySQL + etc) is also a major plus for anybody with a tight budget.

The whole benefit of any server-side technology, though, be it PHP, Perl, ASP, or even old CGI, is having dynamic content as maw pointed out and code reduction as mentioned by M11.
 
You want an example of PHP and HTML then just look at this forum its done in PHP and the viewing of it is in HTML so there are many benefits to PHP and HTML.
 
paulmofyourhand said:
Can somebody tell me what are the benefits of using PHP and HTML?

just a quick or through overview would be greatly appreciated

Relative to what? HTML+ASP? HTML on its own? Having people call you on the phone to get information?
 
Back
Top