PHP Tutorial

PHP Tutorial

PHP Introduction

PHP is a server-side scripting language which is used for web development. It stands for Hypertext Preprocessor. It is faster than another programming language. It supports multiple databases like MySQLSQLPostgreSQL and many more.

History of PHP

PHP was developed by Rasmus Lerdorf in 1995. It is used to develop a dynamic web application. The earlier name of PHP was a personal homepage.

The PHP code is usually processed by PHP interpreter as a module in the web server or as a Common Gateway Interface (CGI).

Why should we use PHP?

We should use PHP because of various reasons.

  • It runs on various platforms like (Windows, Linux Mac, etc.)
  • It is compatible with all servers like (Apache, IIS, etc.)
  • It supports a wide range of databases.
  • It is free.
  • It is easy to learn.

Features of PHP

There are various features of PHP that are given below.

  • Performance
  • Embedded
  • Portability (Platform Independent)
  • It is easy to use in comparison to other languages.
  • It is an open Source programming language.

Hello world program in PHP

Before start PHP, let us take a simple example of a hello world!. We know that PHP is embedded in HTML.

The most common tag of PHP is:

<?php ….?>.
<html>
<head>
<title>Hello World</title>
</head>
<body>
<?php echo "Hello, World!";?>
</body>
</html>

Output

Hello World

PHP Tutorial

Misc

  • PHP Multidimensional Array
  • PHP sort array
  • PHP Array Length
  • PHP array push
  • PHP array to string
  • PHP in_array
  • Types of Array in PHP
  • PHP Function
  • PHP Cookie
  • PHP Session
  • PHP File Upload
  • Upload Image in PHP
  • PHP Date Format
  • PHP Error Reporting
  • PHP try catch
  • PHP Database Connection
  • PHP String Functions
  • PHP substr
  • OOPs Concepts in PHP
  • PHP class
  • PHP Constructor
  • Inheritance in PHP
  • PHP Abstract class
  • PHP Interface
  • PHP Namespace
  • PHP isset
  • PHP str_replace
  • PHP strpos
  • PHP Date Function
  • PHP Display Errors
  • PHP Form Validation
  • PHP mail() Function
  • PHP redirect
  • PHP Ternary Operator
  • PHP String replace
  • PHP trim
  • PHP use
  • What is PHP used for
  • Crud Operations in PHP
  • Features of PHP
  • How to define a function in PHP
  • How to Install PHP
  • PHP Header
  • PHP Header Location
  • PHP strtotime
  • PHP Syntax
  • How to run PHP program
  • PHP const
  • PHP Current Date
  • File Handling in PHP
  • PHP File
  • PHP Introduction
  • PHP JSON
  • PHP Pagination
  • PHP Preg_match
  • PHP urlencode
  • PHP var_dump
  • Advantages of PHP
  • Get and Post Method in PHP

Interview Questions

  • PHP Interview Questions
  • PHP OOPs Interview Questions

CMS Tutorial


Related Topics

PHP empty() Function

PHP empty() Function The empty() function in PHP determines whether the specified variable is empty or not. The specified variable is considered empty if it does not exist or if its value is equal to FALSE. This function...

1 minute read.

PHP is_null() Function

The is_null() function in PHP is used to  find whether the specified variable is a null or not. It returns a Boolean value true if the parameter var is null else it returns...

1 minute read.

PHP sha1_file() Function

PHP sha1_file() Function The sha1_file() in PHP calculates the sha1 hash of a file and returns the hash (40-character hexadecimal number). Syntax sha1_file ( string $filename [, bool $raw_output] )  Parameter filename(required)- This parameter represents the filename of the file to hash. raw_output(optional)- This...

1 minute read.

PHP in_array() Function

PHP in_array() Function The in_array() function in PHP checks if the value exists in the specified array or not. Syntax in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )  Parameter needle(required)- This parameter represents the searched value. haystack(required)- This parameter represents the input array. strict(optional)- This parameter...

1 minute read.

PHP array_diff_key () Function

PHP array_diff_key () Function The array_diff_key () Function in PHP compares the keys from array1 against the keys from arrays. It returns an array containing all the entries from array1 whose keys are absent from all other arrays. This function is like array_diff () except that...

1 minute read.

PHP array_replace() Function

PHP array_replace() Function The array_replace() function in PHP replaces the elements from passed arrays into the first array with values having the same keys in each of the following arrays. Syntax array_replace ( array $array1 [, array $... ] ) Parameter array(required)- This parameter represents...

1 minute read.

PHP convert_cyr_string() Function

PHP convert_cyr_string() Function The convert_cyr_string() function in PHP converts from one Cyrillic character-set to another. The supported characters set are given below: k - koi8-rw - windows-1251i - iso8859-5a - x-cp866d - x-cp866m...

1 minute read.

PHP array_product() Function

PHP array_product() Function The array_product() function in PHP calculates the product of values in an array. Syntax array_product ( array $array ) Parameter array(required)- This parameter represents the input array. Return This function returns the product of the array elements as an integer or float....

1 minute read.

PHP krsort() Function

PHP krsort() Function The krsort() function in PHP sorts an array by key in reverse order while maintaining the keys. Syntax krsort (array & $array[,int $sort_flags= SORT_REGULAR] ) Parameter array(required)- This parameter represents the input array. sort_flags(optional)- This...

3 minutes read.

PHP nl_langinfo() Function

PHP nl_langinfo() Function The nl_langinfo() function in PHP returns specific local information. This function does not work on Windows platforms. Syntax nl_langinfo ( int $item ) Parameter Item(required)- This parameter specifies the  integer value of the element or the constant name of the...

1 minute read.

PHP strlen() Function

PHP strlen() Function The strlen() function in PHP is used to return the length of the specified string. Syntax strlen ( string $string ) Parameter string(required)- This parameter represents the string which is measured for length. Return This function returns the length of the string on success or returns 0 if the specified...

1 minute read.

PHP is_integer() Function

The PHP is_integer() function in PHP is used to  find whether a variable is an integer or not. It returns a Boolean value true if the parameter var is integer else it returns...

1 minute read.

PHP parse_str() Function

PHP parse_str() Function The parse_str() function in PHP parses a query string into variables. Syntax parse_str ( string $encoded_string [, array &$result ] ) Parameter encoded_string(required)- This parameter represents the input string. result(optional)- This parameter specifies the name of an...

1 minute read.

PHP array_chunk() Function

PHP array_chunk() Function The array_chunk() function in PHP is used to split an array into chunks where the last chunk may contain less than size elements. Syntax array_chunk ( array $array , int $size [, bool $preserve_keys ]...

1 minute read.

PHP is_int() Function

The PHP is_int() function in PHP is used to  find whether a variable is an integer or not. It returns a Boolean value true if the parameter var is integer else it...

1 minute read.

PHP vfprintf() Function

PHP vfprintf() Function The vfprintf() function in PHP writes a formatted string to a specified output stream. Syntax vfprintf ( resource $handle , string $format , array $args )  Parameter handle(required)- This parameter represents where to write the string. format(required)- This parameter specifies the string and how to format the...

3 minutes read.

PHP Array Functions

There are various array functions in PHP. They are used to access and manipulate the elements ofan array. Following are functions of array. Array Function Description array() It is used to create an array. array_change_key_case() It is...

3 minutes read.

PHP array_unshift() Function

PHP array_unshift() Function The array_unshift () function in PHP prepends one or more elements to the beginning or front of an array. It returns the new number of elements in the array. Syntax array_unshift ( array &$array [, mixed $... ] ) Parameter array(required)- This array represents...

1 minute read.

PHP strtoupper() Function

The strtoupper() function in PHP is used to convert a string to uppercase. This function is binary-safe. The related functions are as follows: strtolower()lcfirst()ucfirst()ucwords() Syntax strtoupper ( string $string ) Parameter string(required)- This parameter represents the input string. Return This function returns a string with all alphabetic...

1 minute read.

PHP Arrays

PHP Array is usedto hold more than one value at a time.  In another words, we can say that an array stores multiple values in one single variable. Following are the...

2 minutes read.