What is the main purpose of php? I installed my Apache and PHP latest version. I tried programming in php but i couldn't find anything good with it. When is the right time to use php? Should i use php or javascript?
php Is good because you can store members and member details into databases, with this you can call this information and create hundreds, thousands or even millions of dynamic pages in seconds. Basically it makes teh job easier
Interaction with databases as mentioned above is very important. Some simpler exmples: How long would it take you to update the footer on a 100 page site using static html? If your footer is included using php you simply modify one file and the change appears site wide. Or to change the adsense code, the header or the navigation?
You don't need PHP, but its a smart thing to have some kind of server side language, so you can run a forum, blog, and whatever. Usually without such a server side language setup on your server, you can't really make super interactive sites. You could with JS and such, but no where near as much as you can with PHP
The title is a bit misleading, web design is programming language independent. Also, if you cannot find anything good to do with PHP may I suggest you read about web development technologies and tools. For programmers, it is obvious what one can do with PHP and other languages. Lastly, Javascript is a client-side language and PHP is server-side. This forum (product) was developed using PHP.
As it is mentioned earlier PHP is server side language while JS is browser side language. The difference is that in PHP the code is processed by server, and browser gets only the result of code, while with JS the whole code is sent to browser that has to compute it on-fly. For example you cannot make the login page in JS, because you have to sent out the code that checks the password, so anyone can read it. When you make it in PHP no one can see the code.
In the past, I used php to create completely applications but as ajax has grown in popularity and implementation, I have been moving more and more toward using php for back-end processing and ajax (javascript/css/html) for front-end processing. The big advantage in using server-side programming is that the user/client never sees the source code which provides a higher degree (although not perfect of course) level of security. However, a big advantage in using client-side programming is that it puts the processing load on the user's computer instead of your servers. -Zeras
Keym4k3r sums it up quite well. Php allows for secure functionality within a website. People *can* still find exploits, but it's not nearly as easy.
php is vary easy to use because it is a script language. and yor can also find more php hosting than jsp and .net
html is all output based, where as php is input based.. if you tryed to store data via html you would fail misserably .
Simply because there is more hosting around is not a valid reason. You need to take into account the development time for the average enterprise web application and memory/cpu requirments for a medium to large project. Yes, php is easy, quick and fast, as long as you are not aiming at enterprise. If your website's script is very complex or requires a lot of cpu you are much better of with asp.net (or even jsf - though I'm not a java fan).