How-to articles, tricks, and solutions about PHP
In PHP, $this is a special variable that refers to the current object.
You can use the implode() function to convert an array to a delimited string in PHP.
To get the query string parameters in PHP, you can use the $_GET superglobal array.
To remove the trailing delimiter from a delimited string in PHP, you can use the rtrim function.
To get a thumbnail image for a YouTube video in PHP, you can use the file_get_contentsfunction to make a GET request to the videos.list method of the YouTube Data API.
There are several ways to prevent SQL injection attacks in PHP.
In this snippet, you will find comprehensive and helpful guidelines on how to use the expm1() function in PHP.
In this snippet, you will figure out how to use the "or" operator in a switch case in PHP. Read on, check out and try the examples.
Here, we provide a snippet, explaining how to separate odd and even elements from an array without using a loop in PHP. Read on and check out the examples.
There is a password hashing technique, used for building the security of passwords. It is called bcrypt. Here, you will learn how to use it in PHP.
In PHP, notices are known as “soft errors”. However, at times developers want to turn them off. Here, we will show you how to act to turn off PHP notices.
Sometimes, in the course of working with PHP, it is necessary to remove and reindex an array element. Here, you will find simple and helpful methods to do that.
Here is a snippet that will help you to deal with a common PHP undefined offset error. Here, you will find three methods that help to avoid such an error.
Logical operators are supported by PHP. Let’s explore how to use one of the most commonly used logical operators in PHP: AND.
While working with arrays, it is commonly necessary to count all its elements. This snippet will discover two helpful functions that will help you do that.
The aim of this snippet is to represent to you the PHP mhash_keygen_s2k() function. Read on and check out the example for better understanding.
The given snippet explores how to read request readers in PHP. Read it and learn the most helpful methods of reading any request headers in PHP.
Sometimes, it is necessary to replace a given word inside a string in PHP. Here, we will consider three helpful functions that help to carry out the task.
In this snippet, we will demonstrate to you how to use one of the common PHP functions: func_get_arg().
With the help of this snippet, you can learn how to log errors and warnings in a file in PHP. Go ahead and check out the examples.
In this snippet, we demonstrate the simplest way of measuring the execution time of a string in PHP. Read on and check out the examples.
Here, we will demonstrate how to use standard callbacks, static class method callbacks, object method callbacks, as well as closure callbacks in PHP.
PHP provides a range of extensions and functions for getting the number of pages in a PDF document. Let’s check out the most efficient ones, here.
This snippet will assist you in working with classes in PHP. Learn how to generate static classes with the help of our guidelines.