Introduction to PHP
PHP(Hypertext Preprocessor) is widely used as server sripting language developed by Rasmus Lerdorf in the year 1994. It is very popular for developing web applications.
Key features
- Open-source.
- Powerful tool for making dynamic and interactive web pages
- Can integrate with almost all popular databases like MySQL, PostgreSQL, Oracle, Sybase, Informix, Microsoft SQL Server etc.
- C like Syntax and easy to learn.
- Object oriented scripting language.
- Easily embeddable into HTML
- Loosely typed language.
- Faster compared to other scripting languages.
- It can access and set cookies in browsers.
- Platform independent.
Installation
Installation on Windows, Linux, MacOS
Documentation of the installation guidelines is provided in the official PHP website. Follow the link for installation instructions.
Using OneCompiler
- You don't need to install any software or compiler.
- Just goto OneCompiler and choose the programming language as
Php
and enjoy programming without any installation.
Sample Program
<?php
echo "Hello, world!!!!"
?>
Check Result here
- echo : echo is used to output data to the console/screen.
- print : print is also used to output data to the screen. Both
echo
andprint
are more or less same with small differences, echo doesn't have a return value but print has a return value. echo can have multiple arguments but print takes only one argument. Echo is faster than print comparatively. - // : single line comment
- # : Single line comment
- /* */ : Multi line comment