How-to articles, tricks, and solutions about PHP

How to Convert a String to a Number in PHP

This snippet is dedicated to one of the common PHP issues: how to convert a string to a number. You can easily do that by following the options we provide.

How to Strip all Spaces out of a String in PHP

If you want to get the best solution to how to strip all spaces out of a string in PHP, you are in the right place. Read the snippet and choose your option.

How to Add Elements to an Empty Array in PHP

In this tutorial, we display and describe the most flexible ways to add elements to an empty array. Follow the steps and you will manage that easily.

How to Send a Post Request with PHP

In this snippet, we will share with you the most flexible and powerful ways of sending post requests with the help of PHP. Just check out the examples.

What is the PHP Equivalent of .NET/Java's toString()?

Here is a short tutorial representing to you the most accurate PHP equivalent of .Net/Java’s to string. Read it carefully and check out the examples.

How to Increase the File Upload Size with PHP

Here, we will assist you in finding the best way to increase the file upload size with the help of PHP arsenal. Read it carefully and follow the examples.

How to Convert an Integer into a String with PHP

In this short guide, we will assist you to deal with one of the common issues in PHP: converting an integer into a string. Read it and follow the examples.

How to Convert a Date Format in PHP

On this page, we are going to help you figure out the main ways of converting date formats in PHP.

How to Expire a PHP Session

On this page, we are going to provide you with a step-by-step guide on how to expire a PHP session after 30 minutes.

How to Get the Current Year with PHP

On this page, you will get solutions to a common issue in PHP: how to get the current year.

How to Return JSON from a PHP Script

This short tutorial will represent to you the most effective way of returning JSON from a PHP script.

How to Get the Current Date and Time in PHP

In this short tutorial, we are going to represent to you the most essential ways of getting current date and time in php.

How to Fix "Headers Already Sent" error in PHP

One of the common errors that you can meet in PHP is the “Headers already sent” error. Here, we are going to show you the solution to such an error.

How to Generate a Random String with PHP

This tutorial includes several methods of generating a unique, random, alpha-numeric string with PHP. Follow the examples below, it will be easily done.

How to Create a jQuery Ajax Post with PHP

Here, we will share with you how to create a jQuery Ajax post request with PHP. Just check out the examples and choose the one that suits your needs best.

How to Remove Empty Array Elements in PHP

Very often, it is necessary to remove empty elements of the array in PHP. This snippet will provide you with the most common and efficient way to do it.

How to Convert a PHP Object to an Associative Array

If you want to get a proper explanation of how to convert a PHP object to an associative array, you are in the right place. Just follow the examples.

How to Calculate the Difference between Two Dates Using PHP?

On this page, you have an opportunity to get comprehensive information on how to calculate the difference between two dates with the help of PHP.

How to Remove the Last Character from a String in PHP

A common issue in PHP is removing the last character from a particular string. Here, you can find the methods that will help you to deal with this problem.

How to Prevent SQL Injection in PHP

If you want to learn how to prevent SQL injection in PHP, as well as to get comprehensive information about SQL injections, you are in the right place.

How to Check if a String Contains a Specific Word in PHP

In this short tutorial, we will provide you with the solution to one of the common issues in PHP: how to check whether a string contains a particular word.

How to Delete an Element from an Array in PHP

In this short tutorial, you will find the most proper solution to the commonly asked question by programmers: how to delete an element from an array.

How to Display PHP Errors

Often errors occur while executing a PHP application. Read this snippet to learn how to overcome difficulties and display such errors with the help of PHP.

How to Use the StartsWith() and EndsWith() Functions in PHP

Sometimes, the work with PHP requires to check whether a string starts or ends with a particular string. Learn how to do it with the help of our tutorial.

How to Get the Client IP Address in PHP

Often it is needed to collect clients’ IP addresses for security purposes or for tracking the site activity. Here, we will show you how to do it in PHP.