PHP: What is it and why can't I see the source code??
10 years ago | edited 10 years ago
8
Hi Guys, this is just a simple explanation of why you can’t see php if you list the page source. Okay, let’s start at the beginning. PHP used to stand for Personal Home Page tools. It is a HyperText Preprocessor language and was developed by a guy called, Rasmus Lerdorf in the early days of php’s developement. Now when php has developed into a full-blown language, the name was changed to be more in line with its expanded functionality.
There are many computer languages out there from simple ‘Basic’, (‘B'eginers 'A'llpurpose ’S'imbolic 'I'nterchange.) through 'COBOL’, COmmon Business-Oriented Language. ‘C’, ‘Perl’, ‘Lisp’, A+, APL, Chapel, Fortran, J, Julia, K, Matlab, Octave, PILOT, TUTOR and so-on and so-on. You can see a list of the languages HERE COBOL is one of the oldest computer languages, (I hated learning COBOL at college when I did a BTech Nat Dip, you had to do everything more or less three times. Stupid!) But it was written by an American Woman and she was called Grace Hooper, as well as others.
Anyway I digress - Back to PHP.– PHP is a very popular and general-purpose scripting language which is especially suited to web development. It is fast to put together, it’s very flexible and dealing with things sensibly and realistically in a way that is based on practical rather than theoretical considerations., (Oh and for you non English speakers out there the ‘pragmatic definition’ is; dealing with things sensibly and realistically in a way that is based on practical rather than theoretical considerations. :)
PHP powers everything from your blog to the most popular websites on the internet. In fact you are on a website right now that uses PHP extensively. Okay so what distinguishes PHP from something like client-side JavaScript is that the code is executed on the server, (server-side scripting) generating the HTML which is then sent to you the client, the client being your browser. This is why you cannot see any PHP text on this website’s source code and why it is so useful to programmers and webmaster alike. Here is a small sample of php:
Notice that it is combined in this instance within some html code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Hack This Website</title>
</head>
<body>
<?php
echo "Hello I am on the server of this website and I'm a PHP script!";
?>
</body>
</html>
You can see where the php starts within the html code: <?php and the the echo command which outputs the words “Hello I am on the server of this website and I’m a PHP script!” to your browser. The ?> is the end of the php and we return to the html code and the tags that end the html;
What a nice post @ANONRA , sure this will help the people asking why PHP is not in the source code.
I don’t really think there is other post in the forum concerning this.
By the way. if you use [code]code here[ /code]
it would be better for the above HTML :)
Again Great Post :)
If you make people think they’re thinking, they’ll love you. but if you really make them think, they’ll hate you.
~ Harlan Ellison
10 years ago | edited 10 years ago
0
Yeah true sorry about that I wrote in on my word documents package and should have edit it will do now. Slapped wrist! lol :)
P.S. All done, is that better mate?? Also thanks for your kind words. :)
@ANONRA: Nice explaination. I hope this post will help a lot of newbies who don’t know much about server - client.
Really nicely done mate , you gave an important piece of information…on PHP.
Fabulous Work buddy :D
10 years ago
0
Thanks guys very kind of you to say so! :) :) :)
Very nice writing there @ANONRA . Can’t give you a +ve karma ‘cus I can’t see it on my cell.
Hmm.. Maybe this should be moved to the articles section so that more people can read this post easily as it will be lost somewhere in time! What do you say @flabbyrabbit ?
- @IAmDevil
Its good to be back! :D
10 years ago
0
Great post ANONRA, and thank you for the wink at non English speakers :)
I have just started to learn php and your post clarify some questions in my mind thank you again :)
@ayan.upadhaya: Just google and you will see a lot: server-side scripting.
Java, Perl, Python, Ruby…: Do these names ring any bell?