Home » Programming

How to Write/Save to a File with PHP [Examples]

PHP Write/Save File

This tutorial will demonstrate how to write data to a file on the server in the PHP programming language. Code examples are provided to show you how it’s done. Writing data to a file server-side is a common task. Whether you’re writing log files so you can debug your app, or saving user submitted data, you will need to save a file at some point in your web development career. Writing data to a file in PHP is a three-step process. You must first open … Read more

Categories PHP

Home » Programming

Searching JavaScript Arrays with the Array.find() Method [Examples]

Javascript Array find()

This tutorial will show you how to search arrays in JavaScript using the Array.find() method, and show some code examples. JavaScript Arrays An array is a type of variable that holds an ordered list of values (or references to other variables), called array elements. Each element has a position in the array, called the index – and can be accessed by using that index. We’ve got a whole pile of things you can do with JavaScript arrays. Accessing elements in the array by their index is convenient, … Read more

Home » Programming

How to Resize/Crop Images in PHP with the GD Library

PHP Resize/Crop Image

This tutorial will show you how to resize or crop images in the PHP programming language. Code examples are provided which can be copy and pasted into your project. GD Library vs ImageMagick Image resizing in PHP is performed by an optional image processing library. The two most popular image processing libraries for PHP are GD and ImageMagick. Both work well, but I’ll be sticking to the GD Library for this tutorial as it is the most popular and supported. Installing the GD PHP Extension The GD library … Read more

Categories PHP

Home » Programming

Ultimate Guide to Uploading Multiple Files With PHP [Examples]

PHP Multiple File Uploads Ultimate Guide

This tutorial will explain how to upload one or multiple files from the web browser to the server using PHP. Code examples are included, including the code for limiting file size and type. Being able to have your users upload files to your app has become expected functionality in most web apps. Photos, filled out PDF forms, videos, recordings – any kind of file can be uploaded, and the process is relatively straight forward. PHP provides all of the required tools for file uploading and … Read more

Categories PHP

Home » Programming

Multidimensional/Nested Arrays in JavaScript [Guide]

Multidimensional/Nested Arrays in JavaScript

This guide aims to succinctly show you how multidimensional arrays can be created and used in the JavaScript programming language. What are Arrays? Arrays are a key component in any app kind of app you may wish to build – arrays allow you to store an ordered list of variables or values of any length in a single variable – ready to be iterated over, displayed, or otherwise processed. For example, an array could contain a list of contacts for an instant messaging application, or … Read more

Home » Programming

How to Rename Files & Directories in PHP [Examples]

PHP Rename File

This tutorial will show you to rename files and folders in PHP with the rename() function – including some code examples you can use in your own project. We’ve already covered uploading files and deleting files in PHP, read on to find out how to rename them. rename() PHP Function Syntax The syntax for the rename() function used to delete files in PHP is as follows: rename($FROM, $TO, $CONTEXT) Note that: $FROM is the path of the existing file you wish to rename $TO is the new path you wish to rename … Read more

Categories PHP

Home » Programming

Output or Display an Image in the Browser from PHP

PHP Output Image File

This article will show you how to output or display an image in the web browser from PHP, with a quick copy & paste code snippet. Images in PHP We’ve covered how to resize images in PHP using the GD library. Once an image is created, it can be saved or returned to the browser to be displayed without saving it. Outputting/Displaying an Image in PHP without Saving it The following PHP code snippet creates an image object and returns it without saving it: // The header() function is … Read more

Categories PHP

Home » Programming

How to Locate the PHP.ini Configuration File [Linux/Ubuntu]

Locate PHP ini configuration

Here’s a quick tip on how to locate the php.ini configuration file which is currently in use by PHP on your system or web host. Locate PHP.ini From the Command Line You can usually find out which php.ini file PHP is pulling its configuration from from the command line. The php -i command will print the information about your current PHP environment and grep will filter that output to only lines containing the string ‘Configuration File’, including it’s location: php -i | grep ‘Configuration File’ Finding the PHP.ini Configuration in Use for … Read more

Categories PHP

Home » Programming

Java vs Python – What are They and Which Should I Learn/Use in 2022?

Java vs Python

Java and Python are versatile programming languages used for thousands of projects – so, which one should you learn for your projects? Below, I’ll look at what Python and Java are, what they’re best at, and who’s using them – so that you can decide for yourself. What is Python? Python is a general-purpose programming language that can be used for everything from scripting to building full-blown web and desktop applications. It’s designed to be easy to read, easy to learn, and easy to write. It’s been … Read more

Home » Programming

JavaScript vs Python – Which Should I Learn in 2022?

JavaScript Vs Python

If you’re looking to learn how to program, Python and JavaScript are obvious choices – but which one would be most useful to you? Python and JavaScript are probably the most popular programming languages at the moment, and both have a lot of tutorials to follow. If you don’t have a specific task or problem you wish to solve, it can be difficult to decide which programming language to learn. While the fundamentals are the same regardless of language, the applications are different. Fortunately, JavaScript … Read more