Php

Brooke's picture

She has: 681 posts

Joined: Feb 1999

Hello all,

I don't know if this is in the right spot - but I will try it anyway.

What is php?
Why is it used?
When is it used?
Is it harder to make than html?

I don't know anything about php - so I am just learning and thought I would start here.

TIA

Brooke

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Official site: http://www.php.net

PHP means 'PHP Hypertext Processor'
(a recursive acronym, like GNU = GNU's Not Unix)

PHP is a server-side scripting language. And from the FAQ on the site: "The goal of the language is to allow web developers to write dynamically generated pages quickly."

It is harder to write PHP scripts than HTML pages because PHP is a scripting language, whereas HTML is a markup language. The difference is that markup languages lack logic, they simply format. (ex: try adding numbers with HTML, let alone connecting to a database)

I was very general. Do you have questions on something specific?

Mark Hensler
If there is no answer on Google, then there is no question.

Brooke's picture

She has: 681 posts

Joined: Feb 1999

So PHP is something that you would use with a database to search it. (amongst many other things) Is that right?

For a database - would you create an html form with form fields to search - or would you create a php form with form fields?

Brooke

Busy's picture

He has: 6,151 posts

Joined: May 2001

hopefully without confusing you.
PHP has heaps of built in "things", example on forms when you name the form options, they become varibales for PHP
...
enter your name
...

so "your_name" becomes $your_name in PHP (variables etc have to start with dollar sign). so with PHP I could now put

<?php
echo "Hello $your_name"
?>
and when viewed you'd see Hello name (name being whatever was entered in the form).

<?php
and
?>
are like html or script tags
echo prints to screen, same as printf etc
$your_name is the vaule of what was given in the form.
This is of course without database example

If you have no programing experience it could get a lil tricky in the advanced stuff but at least the basics of PHP is pretty easy

good luck

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Funny but initially PHP stood for Personal Home Page.

PHP parses PHP code into HTML, so you would build your form in PHP and it would parse it to HTML. Quite simply a little bit of PHP code like:

<?php
echo \"<HTML>\n\";
echo \"<HEAD>\n\";
echo \"<TITLE>\n\";
echo \"Brooke's Page\";
echo \"</TITLE>\n\";
echo \"</HEAD>\n\";
echo \"<BODY>\n\";
echo \"Page Contents\";
echo \"</BODY>\n\";
echo \"</HTML>\n\";
?>

Would actually build an entire (but simple) HTML page.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

moving this up to webmaster's corner, where she belongs.

php is nice in that you can have the scripting on the "page", unlike perl which requires some more complex templating.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Quote: Originally posted by mairving
Funny but initially PHP stood for Personal Home Page.

I've heard that too, but have never found documentation of it. So, I just tell people of the recursive acronym (as that's what's currently in the FAQ on the site).

Mark Hensler
If there is no answer on Google, then there is no question.

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Here is a little bit about the history.

mjames's picture

They have: 2,064 posts

Joined: Dec 1999

Two of my favorite PHP things are there is no CHMODing or anything of the like with PHP and also, code written in PHP is protected so someone can't just view the source and copy it. It shows what the server reads - which I'm sure is also true for other server-side languages, but still nice.

I hope I'm accurate on those - I'm not PHP guru, but I've toyed with it, mostly with my vB.

They have: 11 posts

Joined: Mar 2002

here's an article for you to read Laughing out loud

there's a also very active PHP forum at SitePoint Forums here... i'm there often too Laughing out loud... go there and ask any questions and you're bound to get a quick reply Smiling... honestly, i learnt alot just reading the posts...

OpenBook - a PHP/MySQL guestbook

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.