Language Selection

English French German Italian Portuguese Spanish

PHP Leftovers/Programming

Filed under
Development
  • Use of glob() function in PHP

    glob() function is a built-in PHP function that is used to search the specific files or folders based on the pattern. It returns the file and folder names in an array that matches the pattern. How this function can be used to search the particular files or folders is shown in this tutorial.

  • Use of hash functions in PHP

    Data security is very important for any application. The unauthorized access of the data can damage the valuable data of the application. If the data can be secured by applying proper encryption, then unauthorized access of the data can be prevented. For example, the password of the new user requires to encrypt before storing in the database to prevent unauthorized access of the user easily. One way of encryption is to use the hash function. Many built-in hash functions exist in PHP to encrypt the data. It encrypts the data without changing its original meaning. Some commonly used hash functions of PHP are md5(), sha1(), and hash(). The uses of these functions are explained in this tutorial.

  • Use of getenv() function in PHP

    Environment variables are used in PHP to set up the application and retrieve the different types of data dynamically from the server. The database credentials, API keys, etc., are visible to the code through the environment variable instead of using any configuration file. When any PHP script runs, then it will inherit all required environment variables from the server. There are two ways to read environment variables in PHP. One is getenv() function and another is $_ENV array. The uses of the getenv() function are shown in this tutorial.

  • Use of foreach loop in PHP – Linux Hint

    Many types of loops are supported by PHP. foreach loop is one of them. This loop is mainly used to parse array and object variables. When the total number of array elements is undefined, then it is better to use a foreach loop than another loop. The number of iterations of this loop depends on the number of array elements or the number of properties of the object used in the loop for reading. How this loop can be used for reading array and object variables is shown in this tutorial.

  • Use of PHP Global Variable – Linux Hint

    The variable is used to store any value temporarily in the script. Two types of variables are used in any programming language. These are local and global variables. The variables which are accessible anywhere in the script called global variables. That’s mean the value of the global variables can be accessed or modified inside and outside of the function. But if the name of any global variable is the same as any variable declared inside a function there are some ways to recognize the global variable inside the function. Two types of global variables are used in PHP. One is a user-defined global variable and another is a superglobal variable. Some useful superglobal variables are $_GLOBALS, $_SERVER, $_REQUEST, $_GET, $_POST, $_FILES, $_COOKIE and $_SESSION. How the user-defined global variable can be declared, assigned, and changed inside and outside the function have shown in this tutorial.

  • Use of Heredoc in PHP – Linux Hint

    Heredoc is one of the ways to store or print a block of text in PHP. The data stored in the heredoc variable is more readable and error-free than other variables for using indentation and newline. How the heredoc content can be stored in a variable or printed has shown in this tutorial.

  • Retrieve the Full URL in PHP – Linux Hint

    Two types of global variables can be used in PHP: the superglobal variable and the user-defined variable. $_SERVER is a superglobal array variable that is used to retrieve the full path of the current page. The protocol (HTTP or HTTPS) of the URL is also required to get the full URL of the page. If $_SERVER[‘HTTPS’] returns ‘on’, then HTTPS will be used with the URL address, otherwise, HTTP will be used. How the full URL address of the current page can be retrieved using the $_SERVER array has been explained in this tutorial.

More in Tux Machines

Noise With Blanket

Videos/Audiocasts/Shows: Linux Journal Expats, Linux Experiment, and Krita Artwork

  • You Should Open Source Now, Ask Me How!

    Katherine Druckman chats with Petros Koutoupis and Kyle Rankin about FOSS (Free and Open Source Software), the benefits of contributing to the projects you use, and why you should be a FOSS fan as well.

  • System76 starts their own desktop environment, Arch goes the easy route - Linux & Open Source news

    This time, we have System76 working on their own desktop environment based on GNOME, Arch Linux adding a guided installer, Google winning its court case against Oracle on the use of Java in Android, and Facebook is leaking data online, again. Become a channel member to get access to a weekly patroncast and vote on the next topics I'll cover

  • Timelapse: inking a comic page in Krita (uncommented)

    An uncommented timelapse while inking this page 6 of episode 34 of my webcomic Pepper&Carrot ( https://www.peppercarrot.com/ ). During the process, I thought about activating the recorder and I even put a webcam so you can see what I'm doing on the tablet too. I'm not doing it for everypages; because you can imagine the weight on disk about saving around 10h of videos like this; and also how it is not multi-tasking: when I record, you don't see me open the door to get the mail of the postman, you don't see me cleaning temporary accident of a cat bringing back a mouse at home, you don't see me typing to solve a merge request issue to merge a translation of Pepper&Carrot.

Kernel Leftovers

  • [Intel-gfx] [RFC 00/28] Old platform/gen kconfig options series
  • Patches Resubmitted For Linux With Selectable Intel Graphics Platform Support

    Back in early 2018 were patches proposed for selectable platform support when building Intel's kernel graphics driver so users/distributions if desired could disable extremely old hardware support and/or cater kernel builds for specific Intel graphics generations. Three years later those patches have been re-proposed. The patches then and now are about allowing selectable Intel graphics "Gen" support at kernel configure/build time so that say the i8xx support could be removed or other specific generations of Intel graphics handled by the i915 kernel driver. This disabling could be done if phasing out older hardware support, seeking smaller kernel images, or other similar purposes. The patches don't change any default support levels but leaves things as-is and simply provides the knobs for disabling select generations of hardware.

  • Linux Kernel Runtime Guard 0.9.0 Is Released

    Linux Kernel Runtime Guard (LKRG) is a security module for the Linux kernel developed by Openwall. The latest release adds compatibility with Linux kernels up to soon to be released 5.12, support for building LKRG into kernel images, support for old 32-bit x86 machines and more. Loading the LKRG 0.9.0 module will cause a kernel panic and a complete halt if SELinux is enabled.

  • Hans de Goede: Logitech G15 and Z-10 LCD-screen support under Linux

    A while ago I worked on improving Logitech G15 LCD-screen support under Linux. I recently got an email from someone who wanted to add support for the LCD panel in the Logitech Z-10 speakers to lcdproc, asking me to describe the process I went through to improve G15 support in lcdproc and how I made it work without requiring the unmaintained g15daemon code.

Devuan 4.0 Alpha Builds Begin For Debian 11 Without Systemd

Debian 11 continues inching closer towards release and it looks like the developers maintaining the "Devuan" fork won't be far behind with their re-base of the distribution focused on init system freedom. The Devuan fork of Debian remains focused on providing Debian GNU/Linux without systemd. Devuan Beowulf 3.1 is their latest release based on Debian 10 while Devuan Chimaera is in the works as their re-base for Debian 11. Read more