Practical solutions

PHP Howtos How-To Guides

Solve the problem. Keep building. Collection of PHP how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Print Array Keys in PHPThis tutorial will teach you different methods you can use to print the keys of PHP arrays. These methods will use the foreach loop and the array_keys function. How to Merge PDFs in PHPThis tutorial demonstrates how to merge multiple pdf files using PHP. How to Send Data in URL to View the Single Record of a Selected ProductThis tutorial shows you how to dynamically send data in URL(s), retrieve the user's selected product records and make them viewable on the product.php?pid='id_value'. Learn how to fetch data from SQL using MySQL and PODS. How to Run Shell Scripts in PHP and Open Shell FileThis tutorial will demonstrate how to run shell scripts in PHP. We will implement our script using PHP's shell_exe() and shell() functions. How to Delete Cookies in PHPThis article introduces how to delete cookies in PHP How to Create a Webhook in PHPThis tutorial shows how to create a webhook in PHP. We will create a webhook.log file. This file will contain some text in the array format that we will retrieve from our example.json file. We will use a PHP script to decode this JSON file and print it. How to Use HTML Image Tag Inside PHPIn this article we'll discuss how to use HTML image tag inside PHP, store a URL in a variable and echo it directly in the source and use the str_replace() function for URL conversion while using the iframe tag in PHP. How to Set Environment Variable in PHPThis tutorial is an illustrated step-by-step guide that teaches you how to set the environment variable for PHP in a local development environment like WAMP. How to Push Items to Associative Array in PHPIn this tutorial, we will see how you can add items or elements into an associative array in PHP. How to Fetch Data From Database and Show the Data in the HTML Table Using PHPWe will learn the process of creating a database and table in MySQL and how to retrieve the mysql table dynamically and show it in the HTML. How to Create a Signature From Hash_hmac() and Sha256 in PHPWe will create string based keys and turn them into secret signatures, we will use hash_hmac() method with some of the most common HMAC methods for crypotographic conversions. We will also create a complex signature using sha256 and hex2bin and bin2hex functions in PHP. How to Create a PHP Dropdown ListThis article will introduce the dropdown list and how to create one with PHP. How to Check for Numerical Characters in PHPIn this tutorial, we'll learn about how to check for numerical characters in PHP. We will use PHP built-in functions like ctype_digit, preg_match, strpos, is_numeric, and filter_var. How to Insert Special Characters Into a Database in PHPThis tutorial will introduce the mysqli_real_escape_string() function to insert special characters into a database in PHP. We will compare inserting data with and without the mysqli_real_escape_string() function. How to Validate Phone Number in PHPThis tutorial demonstrates various way on how to validate phone numbers in PHP. How to Serialize Function in PHPThis tutorial demonstrates the use of serialize(), built-in function in PHP. How to Resize Image Resize Upload in PHPThis tutorial demonstrates how resize an image on upload with given width and height in PHP. How to Group Arrays in PHPThis tutorial demonstrates how to group elements of a multidimensional array according to a particular column in PHP. How to Generate Image using PHPThis tutorial demonstrates how to generate images using GD library in PHP. How to Concat PHP ArraysThis tutorial demonstrates how to concat two or more arrays in PHP. How to Add Element to an Associative Array in PHPThis tutorial demonstrates how to add an element to an associative array in PHP. How to Display Array Values in PHPThis tutorial demonstrates how to display the values of an array using different methods in PHP. How to Flatten Array in PHPThis tutorial demonstrates how to flatten multidimensional arrays in PHP. How to Get Headers in PHPThis tutorial demonstrates how to get headers sent by the server in response to an HTTP request.