How-to articles, tricks, and solutions about PHP

How to Split a Comma Delimited String to an Array with PHP

On this page, we are going to provide you with comprehensive information about a common PHP issue: how to split a comma delimited string into an array.

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 store file name in database, with other info while uploading image to server using PHP?

To store the file name in a database along with other information while uploading an image to a server using PHP, you can follow these steps:

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 to send mail using gmail in Laravel?

To send email using Gmail in Laravel, you can use the built-in Swift Mailer library.

How to Truncate a string in PHP to the word closest to a certain number of characters?

To truncate a string in PHP to the word closest to a certain number of characters, you can use the following code:

How to Turn Off Notices 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.

how to upload file using curl with PHP

To upload a file using cURL in PHP, you can use the curl_setopt function to specify the CURLOPT_POSTFIELDS option with the file data.

How to upload files in Laravel directly into public folder?

To upload files directly into the public folder in Laravel, you can use the storeAs method provided by the Storage facade.

How to Use "or" in Switch Case 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.

How to Use bcrypt to Hash Passwords in PHP

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.

How to Use Callbacks in PHP

Here, we will demonstrate how to use standard callbacks, static class method callbacks, object method callbacks, as well as closure callbacks in PHP.

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 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 php array with sql IN operator?

You can use the implode() function to convert the PHP array into a string of comma-separated values, and then use that string in the SQL query with the IN operator.

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 Use setInterval in PHP?

setInterval is a JavaScript function and cannot be used directly in PHP.

How to use sha256 in php5.3.0

In PHP 5.3.0, you can use the hash function to create a SHA-256 hash.

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 Use the AND Operator in PHP

Logical operators are supported by PHP. Let’s explore how to use one of the most commonly used logical operators in PHP: AND.

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 Use the expm1() Function in PHP

In this snippet, you will find comprehensive and helpful guidelines on how to use the expm1() function in 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 func_get_arg() Function in PHP

In this snippet, we will demonstrate to you how to use one of the common PHP functions: func_get_arg().