PHP Tutorial

PHP Introduction PHP is a server-side scripting language that is used for web development. Itstands for Hypertext Preprocessor. It is faster than other programming language. It supports multiple databases like MySQL, SQL, PostgreSQL and many more. History PHP was developed by Rasmus Lerdorf in 1995. It is used to develop dynamic web application. The earlier …

Read morePHP Tutorial

PHP Example

We can create a simple program by writing the source code inside the php tag and save it with.PHP extension. Syntax:

Let us take an example of PHP.

← Prev Next →

PHP Variables

PHP Variable is the name of memory location used to hold the data.  In PHP, variable starts with $ symbol. Rules for PHP Variables. Variable starts with $ sign. Variable name must start with a letter or the underscore character. Variable name can contain alpha-numeric character (A-Z. 0-9). Variable name are case-sensitive ($name and $NAME …

Read morePHP Variables

PHP $ and $$ Variables

PHP $var variable is a normal variable that stores any value. PHP $$var variable is a reference variable that stores the value of$var inside it. Let us take an example. Example 1

Output Hello 100 100 Example 2

Output : Rasmus Rasmus Rasmus ← Prev Next →

PHP Super Global Variables

There are various predefine “superglobals” in PHP. These variables can easily accessible in function or class. Following are the superglobals variables: $GLOBALS $_SERVER $_REQUEST $_POST $_GETetc. PHP $GLOBALS The “$GLOBAL” isa keyword that is used to accesssuper global variablefrom anywhere in the PHP script. Example 1:

Output 50 PHP $_SERVER PHP  $_SERVER is a …

Read morePHP Super Global Variables

PHP Constant

PHP constant is an identifier(name) for a simple value. The value does not change during the script. It starts with a letter or underscore not $ sign. The define()function is used to create a constant. Syntax:


Output Welcome to PHP Tutorial Constants are Global PHP constant is automatically global. It can be …

Read morePHP Constant

PHP Magic Constants

There are various predefine PHP Magic Constants. It starts with underscore(__) and ends with double underscore.  Magic Constant Description __LINE__ To check current line number of the file. __FILE__ To check full path and filename of the file. __FUNCTION__ To check function name. __CLASS__ To check class name. __METHOD__ To check class method name. PHP_VERSION …

Read morePHP Magic Constants