PHP

About PHP

  • PHP is a server scripting language.
  • PHP is an acronym for “PHP: Hypertext Preprocessor”

Prerequisites to start PHP

  1. Webserver, PHP, MySQL. If we install xampp, wamp or laragon we will get all in one!
  2. HTML, CSS, JavaScript

PHP Functions

There are two types of functions which are:

Built in functions: PHP has more than 1000 built in functions.

For example: In the below md5 function will be used to convert the string into md5 hash encrypted data

<?php
$str = "Nazim";
echo md5($str);
?>

User defined function:

Anonyms functions:

// Assigning an anonymous function to a variable
$add = function ($a, $b) {
    return $a + $b;
};

// Using the anonymous function
$result = $add(8, 9); // This will result in $result containing 17

echo $result; // Output: 17