How-to articles, tricks, and solutions about PHP

How to Generate One-Time Password in PHP

On this page, we cover a common issue that almost all the developers come across: generating one time password with PHP that can be reliable and helpful.

How to Use the Double Not(!!) Operator in PHP

The double Not(!!) or the NOT NOT is one of the commonly used operators in PHP. Here, we will show you what it is and how to use it in your practice.

How to Generate a Default Function Parameter in PHP

In this snippet, we will have a look at the process of generating and using default function parameter in PHP.

How to Encrypt and Decrypt a String in PHP

On this page, you can find comprehensive information about encrypting and decrypting a string in PHP. Learn how to do it with the functions of openssl.

How to Append an Array to Another in PHP

While working with PHP, developers wonder how to append one array to another. This snippet is dedicated to the exploration of functions that help to do it.

How to Use the Scope Resolution Operator in PHP

In this snippet, you will find comprehensive information about the scope resolution. Explore the ways of using the scope resolution operator in PHP.

How to Start a PHP Function with an Ampersand

In PHP, an ampersand is put before the function name for returning a reference to the variable instead of returning the value. Learn how to do that, here.

How to Use Continue and Break in PHP

The continue and break keywords are used to control the whole program flow. This snippet will show you examples of how to use these keywords in PHP.

How to Pass Variables by Reference in PHP

Working with variables is an essential part of a developer’s life. In this snippet, we will demonstrate to you how to pass variables by reference with PHP.

How to Use the filter_var() Function in PHP

Let’s dive deeper into the world of PHP. Here, we are going to discover the filter_var() function. Let’s see for what purposes it can be used in PHP.

How to Use the @ Sign in PHP

The @ sign is one of the common used ones in programming. Let’s discover how it can be used in PHP together. Read on the snippet and check the examples.

How to Modify Session Timeout in PHP

In this short snippet, we will represent to you how to modify the session time out with the help of PHP functions.

How to Use echo, print, and print_r in PHP

While working with PHP, every developer should know how to use echo, print, as well as print_r. Read our snippet to learn about these crucial parts of PHP.

How to Use serialize() and unserialize() in PHP

This tutorial can be quite helpful for you, if you are interested in using the PHP serialize() and unserialized() functions in your programming practice.

How to Check Whether a Number is Prime in PHP

Imagine a given number and you want to check whether it is prime or not with PHP. Here, we represent two methods: a simple method and a more efficient one.

How to Fix the Uncaught Error "Cannot Use Object of Type stdClass as an Array"

This short tutorial is dedicated to a common PHP issue "cannot use object of Type stdClass as an array". Read on to find the most accurate solutions.

How to Get Parameters from a URL String with PHP

Learn how to get the parameters from a URL string in PHP with the help of our short tutorial. Read on and check out the helpful examples below.

How to Convert MySQL Data to JSON with PHP

If you wonder how to find a proper way of converting MySQL data to JSON format using PHP, then you are in the right place. Read on and check the example.

How to Fix the "Invalid Argument Supplied for Foreach()" PHP Error

The "invalid argument supplied for foreach()" is considered a common PHP error. With the help of this tutorial, you will figure out how to resolve it.

How to Read Whether a Checkbox is Checked in PHP

In this tutorial, you can find comprehensive information on how to read whether a checkbox is checked in PHP.

How to Resolve the Fatal error: Maximum Execution time of 30 seconds exceeded in PHP

In this tutorial, we will show you handy solutions to implement once you encounter the fatal error: maximum execution time of 30 seconds exceeded in PHP.

How to Set HTTP Header to UTF-8 in PHP

If you want to learn how to set the HTTP header to UTF-8 in PHP, then read this snippet, examine and run the examples, that are demonstrated in it.

How to Print JavaScript Console Using PHP

On this page, we will illustrate how to use PHP echo for printing JavaScript console. Here, you will find several options for different occasions.

How to Get the First Element of an Array in PHP

This snippet gives you an opportunity to learn how to get the first element of an array using PHP. You can choose among the provided functions.

How to Get the First Several Characters of a String in PHP

On this page, we represent to you the ways of getting the first five characters of a string in PHP. Keep on reading the snippet and check out the examples.