View Full Version : PHP Advantages
johnnieblue
Jul 16, 2011, 04:47 AM
Hey Everyone,
I was just wondering about the advantages of coding with PHP, what can you do with it that you can't do with HTML and CSS?
I'm not sure i fully understand exactly what PHP is used for. I researched a bit but i still can't tell if it's something i want to spend my time learning.
Thoughts?
englishman
Jul 16, 2011, 05:05 AM
If you look at any website that isn't just a baby one it will be using PHP or another programming language.
Take this site.
It would be be impossible for any army of web editors to create pages from everyone's contributions.
People's contributions are stored in a database and then the threads are created on the fly from mixing the data in the database and PHP and HTML to create these pages you see.
So the word advantage is the wrong way of looking at it. There is no other way.
johnnieblue
Jul 16, 2011, 05:12 AM
I know...
Like i said, I have researched it a bit but what i was looking for by posting was someone who uses PHP that may have some information regarding it's practical uses.
(this post was in reply to a message that has since been deleted)
Dunmail
Jul 16, 2011, 12:30 PM
Hey Everyone,
I was just wondering about the advantages of coding with PHP, what can you do with it that you can't do with HTML and CSS?
I'm not sure i fully understand exactly what PHP is used for. I researched a bit but i still can't tell if it's something i want to spend my time learning.
Thoughts?
PHP is for server side programming - so it's used for things like database access and content management systems - whereas HTML, CSS and JavaScript are what your browser can understand.
At a simple level you might have a line in all your PHP files like
include("menu.inc.php");
This will pull in the named file and write the code for your menu in to the HTML being sent to your browser. So if you wish to change the menu for your site, all you have to do is modify menu.inc.php, upload it to your server and the site is modified.
You could also do browser sniffing on the server side so when a request for a page comes in you check the browser/OS/device and provide a suitable CSS file (for example). Thus you could serve up an optimised page for smartphones from the same basic source.
HTH
bpaluzzi
Jul 16, 2011, 01:35 PM
Hey Everyone,
I was just wondering about the advantages of coding with PHP, what can you do with it that you can't do with HTML and CSS?
I'm not sure i fully understand exactly what PHP is used for. I researched a bit but i still can't tell if it's something i want to spend my time learning.
Thoughts?
It's not an either/or situation. HTML/CSS/Javascript are the client-side technologies. PHP/Rails/Python/.NET are server-side languages (edit: thanks englishman), and they do the heavy-lifting and data access. The output of those languages is HTML, which is then sent to the browser and rendered.
englishman
Jul 16, 2011, 01:58 PM
It's not an either/or situation. HTML/CSS/Javascript are the client-side technologies. PHP/Rails/Python/.NET are client-side languages, and they do the heavy-lifting and data access. The output of those languages is HTML, which is then sent to the browser and rendered.
Ooops you mean server side
johnnieblue
Jul 16, 2011, 02:52 PM
Awesome. Thanks everyone.
govinthmani
Jul 23, 2011, 07:12 AM
Hi..here i provides some advantages of PHP...
1. Robust Support for Object-Oriented Programming
2. A Completely Rewritten MySQL Extension
3. A Suite of Interoperable XML Tools
4. Cleaner Error Handling with Exceptions
5. A First-Class SOAP Implementation
englishman
Jul 23, 2011, 07:36 AM
Worth noting some disadvantages if thinking of a complete solution.
Unlike .NET or J2EE, PHP is not a complete Enterprise solution to eg mobile phone programming/desktop programming.
haydn!
Jul 23, 2011, 12:20 PM
Even in basic web design it has it's usefulness.
The most popular uses (in basic design) are to use it to repeat certain pieces of html/css so that you don't have to write the same thing over and over and more importantly you can make side wide changes to things like your header, navigation etc by only having to edit one file.
For example, keep you header and footers in separate files then just use PHP to fetch the code to add it to the start/end of each individual page.
Ronald Williams
Jul 29, 2011, 02:06 AM
php or any other programming language makes a website functional and it enables to handle all the data between the users and the servers, to implement complex logics to execute even more complex methods and functions. Php itself is easy to learn so if you are interested then you can get started with programming in php in very less time.
wrldwzrd89
Jul 29, 2011, 08:01 AM
I'm using PHP on my site purely for the include feature, because it makes site development so much simpler. I do wonder, though, if there's a different/better way to include stuff.
bpaluzzi
Jul 29, 2011, 08:03 AM
I'm using PHP on my site purely for the include feature, because it makes site development so much simpler. I do wonder, though, if there's a different/better way to include stuff.
If you're just using it for includes, most hosting companies / servers that support PHP also support generic server side includes:
http://en.wikipedia.org/wiki/Server_Side_Includes
wrldwzrd89
Jul 29, 2011, 08:18 AM
If you're just using it for includes, most hosting companies / servers that support PHP also support generic server side includes:
http://en.wikipedia.org/wiki/Server_Side_Includes
Thanks for bringing this to my attention - I forgot that generic server side includes existed, and thus didn't bother to check if my web host supports them (which it does).
bpaluzzi
Jul 29, 2011, 08:22 AM
Thanks for bringing this to my attention - I forgot that generic server side includes existed, and thus didn't bother to check if my web host supports them (which it does).
Wicked! SSI is great for that kind of stuff -- don't need to worry about the overhead of PHP. Just remember to set up your index file as index.shtml, or visitors will either get a directory listing or an unauthorized (got burned on that for about a week a long time ago) :-)
b
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.