Introduction to PHP - Learn PHP
Introduction to PHP - learn from examples
As of php.net definition says, PHP is a recursive name for PHP: Hypertext Preprocessor and it is an open-source scripting language project. PHP is widely used by new and advanced programmers as it has really advanced features under the hood.
Here is our first PHP scripting example:
[code="php"]
My first PHP example!What should I know before learning PHP
This is the simplest yet powerful PHP command that prints text to the browser. The text is processed on the server-side and sent to the browser as any other HTML text. So before learning PHP you should have a basic understanding of:
- HTML - it is strongly recommended to have a deep understanding of the HTML markup
- CSS - it is recommended to know some CSS basics before learning PHP. This will help you on your way to developing cool and dynamic PHP websites
- JavaScript - it would be nice of you to recognize and have a basic reading of the JavaScript programming language
- Programming Logic - This is something that always helps. Any knowledge of another programming language will help you to learn and apply the logic to the new programming language, in this case PHP
We insist on the part that HTML, CSS, and JavaScript are all three browser-side languages (interpreted by the browser), while PHP is a server-side scripting language. This means that PHP will process everything before sending it to the browser and it will show only the parts that you chose to show, hiding stuff like processing, calculations, variables, etc
What can I do after learning PHP?
The short answer is Anything!
The long answer is bellow, in form of a list. You can build:
- Server-side application - This includes everything from web pages to large and huge dynamic websites, web processors. You can use PHP to build any type of website: bogs, e-commerce, and any other content site. You can also read and write and delete, data on the file system or to the database. This allows you to write user-customized content, generate data-encrypted stuff, and a million other things
- Run scripts from command-line - This mens that you don't really need a browser to run a PHP script. You can run it from command line, set up scheduled tasks or CRON jobs, etc.
- Desktop applications - Although it is not the best choice to do this type of apps, you can use PHP to build desktops based apps
Who is using PHP?
If you think that PHP is a small, simple, or limited scripting language, then think again. There are lots of big sites using PHP:
- Facebook
- Wikipedia
- Yahoo
- Flickr
- Tumblr
- Wordpress
- Digg
... and the list could go on and on, but I think we all have the big picture here.