Category: PHP

  • File Existence

    When working with files in PHP, one important task is to detect whether a specific file exists. This helps make sure that your program does not face errors while trying to access files that may not exist. This chapter will show you how to use basic examples to validate the presence of a file. It…

  • Write File

    This chapter will show you how to create and write files in PHP. PHP is a popular programming language for creating dynamic web pages and applications. Writing files helps you to store data, log messages and create content on the server. What is File Writing? In PHP, file writing means either creating a new file…

  • Read File

    What is File Reading? Working with online applications frequently needs reading data from files. PHP makes it easy to read files from your server. File reading is the process of opening a file and extracting its data for usage in your program. For example, you may want to read a text file that contains user…

  • Open File

    When working with PHP, you will need to read and write files. This chapter explains how to open a file in PHP. This is a important skill for any web developer who want to manage data properly. PHP’s built-in function library provides fopen() function to open a file or any other stream and returns its…

  • File Handling

    In PHP, a file is a resource object, from which data can be read or written to in a linear fashion. The term “file handling” refers to a set of functions in PHP that enable read/write operations on disk files with PHP code. A file object is classified as a stream. Any resource on which linear…

  • $_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.…

  • $_COOKIE

    The PHP superglobal $_COOKIE stores the variables passed to the current PHP script along with the HTTP request in the form of cookies. $HTTP_COOKIE_VARS also contains the same information, but it is not a superglobal, and it has now been deprecated. What is a Cookie? Cookies are text files stored by a server on the…

  • $_ENV

    $_ENV is a superglobal variable in PHP. It is an associative array that stores all the environment variables available in the current script. $HTTP_ENV_VARS also contains the same information, but it is not a superglobal, and it has now been deprecated. The environment variables are imported into the global namespace. Most of these variables are provided by the…

  • $_FILES

    $_FILES is one of the ‘superglobal’, or automatic global, variables in PHP. It is available in all scopes throughout a script. The variable $_FILES is an associative array containing items uploaded via HTTP POST method. A file is uploaded when a HTML form contains an input element with a file type, its enctype attribute set…

  • $_GET

    $_GET is one of the superglobals in PHP. It is an associative array of variables passed to the current script via the query string appended to the URL of HTTP request. Note that the array is populated by all requests with a query string in addition to GET requests. $HTTP_GET_VARS contains the same initial information,…