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

Maximum Upload Size in PHPToday's post will cover maximum upload size in PHP. How to Check if Array Contains a Value in PHPThis tutorial demonstrates how to check if array contains a particular value using a built-in function in PHP. How to Update PHP 7.x to 7.4 on CentOSA historical overview of preparing for and evaluating PHP 7.4 upgrade approaches on CentOS 7, with guidance for version checks and application compatibility. 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 Convert String to Date and Date-Time in PHPLearn how to parse date strings in PHP with strtotime(), date(), DateTime::createFromFormat(), and date_create_from_format(), including format, timezone, and error-handling guidance. How to Set Session Timeout in PHPLearn how to track PHP session activity and enforce a 30-minute inactivity timeout on each request. How to Sanitize Input in PHPChoose PHP input handling for the field, output context, or database operation instead of relying on a universal sanitizer. isset() vs. empty() Functions in PHPCompare isset() and empty() in PHP, see how they treat common values, and use them to check submitted form fields. File Download With CURL in PHPDownload files in PHP with the cURL extension. Check availability, stream responses to disk, and handle transfer and HTTP errors. How to Pass Variables to the Next Page in PHPDifferent approaches on how to pass variables to the next page using PHP, like using GET and POST through HTML form, and using session and cookie. How to Check if File Exists in PHPThis article explains how to check if a file exists in PHP using the file_exists() function. Learn to handle file and directory checks effectively with practical examples. Enhance your PHP applications by ensuring file existence before operations and avoid common errors. 8 Best PHP Code ObfuscatorsThis tutorial demonstrates the eight best code obfuscators in PHP. How to Create a New Line in PHPChoose the right PHP line break for text strings, platform-native files, or HTML output. See how ` `, PHP_EOL, <br>, and CRLF behave. How to Convert an Integer Into a String in PHPThis article introduces how to convert an integer to a string in PHP. How to Get Current Directory Name and Path in PHPThis tutorial introduces how to get the current directory name and path in PHP. Learn various methods including getcwd(), __DIR__, and dirname() to efficiently manage file paths in your PHP applications. Enhance your coding skills and streamline your workflow with these essential techniques. How to Echo or Print an Array in PHPThis article introduces how to echo or print an array in PHP. It includes foreach loop, print_r() function and var_dump() function. How to Remove the Last Character From a String in PHPThis article introduces how to remove the last character from a string in PHP. It includes the rtrim() function and the substr() function. Discover the best methods for string manipulation in PHP and enhance your programming skills with practical examples and clear explanations. How to Detect Mobile Devices in PHPLearn to classify mobile requests in PHP with Mobile Detect or a user-agent pattern. How to Use Foreach Loop in Multidimensional Array in PHPThis tutorial introduces how to use a foreach loop in a multidimensional array in PHP. Enumerations in PHPThis tutorial will teach how to create and use enumerations in PHP. You'll learn how to emulate an enumeration with abstract classes. Also, you'll learn how to work with native enumerations in PHP. New York Timezone in PHPSet the America/New_York timezone in PHP and format a New York date or time with date(). How to Redirect in PHPThis tutorial demonstrates how to redirect a user from a page to a different page in PHP How to Convert a String to a Number in PHPConvert numeric strings to integers or floats in PHP with explicit casts, intval(), floatval(), or settype(). How to Create Array of Objects in PHPThis article introduces how to create an array of objects in PHP