Category: PHP

  • $_POST

    The $_POST variable in PHP is a super global array that collects form data after submitting an HTML form using the POST method. It is particularly useful for securely sending data and receiving user input. What is $_POST? $_POST is a built-in PHP array. It stores data received from an HTML form using the POST…

  • $_REQUEST

    PHP uses a special variable called $_REQUEST to collect data from forms. It can save data sent using GET, POST or COOKIE methods. This makes it easy to get user input and removes the need to think about how the data is transmitted. The $_REQUEST operates according to the parameters in the “php.ini” file, including…

  • $_SERVER

    The $_SERVER is a superglobal in PHP. It includes information about HTTP headers, path, script location, and other things. It is an associative array that contains information about the execution environment and server. The majority of these details are filled in by the web server and each server may have different entries. When running PHP scripts from the command…

  • $GLOBALS

    $GLOBALS is one of the “superglobal” or “automatic global” variables in PHP. It is available in all scopes throughout a script. There is no need to do “global $variable;” to access it within functions or methods. $GLOBALS is an associative array of references to all globally defined variables. The names of variables form keys and…

  • $_SESSION

    One of the superglobal variables in PHP, $_SESSION is an associative array of session variables available in the current script. $HTTP_SESSION_VARS also contains the same information, but it is not a superglobal, and it has now been deprecated. What is a Session? A Session is an alternative way to make data accessible across the pages of an entire website.…

  • Global Variables

    In PHP, any variable that can be accessed from anywhere in a PHP script is called as a global variable. If the variable is declared outside all the functions or classes in the script, it becomes a global variable. While global variables can be accessed directly outside a function, they aren’t automatically available inside a function.…

  • Local Variables

    Scope can be defined as the range of availability a variable has to the program in which it is declared. PHP variables can be one of four scope types − Local Variables A variable declared in a function is considered local; that is, it can be referenced solely in that function. Any assignment outside of…

  • Variable Functions

    PHP Variable Handling Functions are the inbuilt PHP library functions that enable us to manipulate and test php variables in various ways. Installation There is no installation needed to use PHP variable functions; they are part of the PHP core and comes along with standard PHP installation. Runtime Configuration This extension has no configuration directives defined…

  • Arrow Functions

    Arrow functions were added in PHP 7.4 to make it easier and faster to write anonymous functions. Instead of the regular “function” term, you can now type “fn”. The new version simplifies your code, making it cleaner and more readable. Arrow functions are perfect for short, one-line functions because they automatically return the result without the need for an…

  • Anonymous Functions

    What are Anonymous Functions? PHP allows defining anonymous functions. Normally, when we define a function in PHP, we usually provide it a name which is used to call the function whenever required. In contrast, an anonymous function is a function that doesnt have any name specified at the time of definition. Such a function is also called closure or lambda…