PHP Articles

Page 2 of 81

PHP program to find the perimeter of rectangle

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 7K+ Views

A rectangle is a closed two-dimensional figure with 4 sides where opposite sides are equal and parallel. The perimeter is the total distance around the rectangle, calculated by adding all four sides. In this tutorial, we'll learn different PHP approaches to calculate rectangle perimeter. Length Breadth Length Breadth Formula The formula for calculating rectangle perimeter is − Perimeter = 2 × (Length + Breadth) Where length is the horizontal distance and breadth is the vertical distance. Direct Formula Approach The ...

Read More

PHP Program to Check if a Number is an Armstrong Number

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 5K+ Views

An Armstrong number is a number in which the sum of its digits raised to the power of the number of digits is equal to the number itself. In this article, we will discuss how to check if a given number is an Armstrong number using PHP. Examples Let's understand Armstrong numbers with some examples ? Example 1: 9474 This is a four-digit number with digits 9, 4, 7, and 4. 9474 = 9⁴ + 4⁴ + 7⁴ + 4⁴ = 6561 + 256 + 2401 + 256 ...

Read More

How to get selected option value in PHP

PHP
NIKI
NIKI
Updated on 15-Mar-2026 1K+ Views

In this article, we will see how to get selected option values in PHP from HTML forms, with necessary examples. What is "option value" in PHP? Drop-down menus are created using the and tags. PHP allows users to select one or more options from a list through form submissions. Syntax Below is the syntax of the Option Value in PHP − Text Label-1 Text Label-2 The attributes related to the tag are − ...

Read More

How to Add Elements to the End of an Array in PHP

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 9K+ Views

Arrays are linear data structures used to handle data in programming. Sometimes while dealing with arrays we need to add new elements to an existing array. In this article, we will discuss several methods to add elements to the end of an array in PHP, complete with code examples and outputs. Following are different approaches to adding elements to an array − Using Square Brackets [] The simplest way to add an element to the end of an array in PHP is by using square brackets []. This syntax is suitable when you want to add only ...

Read More

How can I force PHP to use strings for array keys?

PHP
Timpol
Timpol
Updated on 15-Mar-2026 326 Views

In PHP, array keys are automatically converted to integers if they contain numeric values. To force PHP to use strings for array keys, you can use several approaches that ensure all keys remain as strings regardless of their content. Understanding PHP Array Key Behavior By default, PHP automatically converts numeric string keys to integers ? array(3) { [0]=> int(1) [1]=> int(2) [2]=> string(4) "name" } Method 1: Using array_combine() The array_combine() function creates an array using one ...

Read More

How to use PHP in HTML?

Harsh Laghave
Harsh Laghave
Updated on 15-Mar-2026 602 Views

To use PHP in HTML, you must enclose the PHP code with PHP start tag . PHP is a server-side scripting language that allows you to embed dynamic content into your HTML pages. PHP (Hypertext Preprocessor) is a popular server-side scripting language used for web development. It allows you to embed dynamic content into your HTML by processing code on the server before delivering the page to the client. Requirements: To run PHP code, you need a web server with PHP installed (like XAMPP, WAMP, or LAMP) since PHP is processed server-side. Basic Syntax ...

Read More

Performing DataBase Operations in XAMPP

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 1K+ Views

Navigating through database operations in XAMPP can be challenging, particularly for beginners. Realizing this complexity, over 15 million active monthly users have turned to XAMPP for its ease of use and flexibility. This article offers a step−by−step guide on performing basic database operations in XAMPP, from data insertion to deletion. Let's take the first stride towards mastering your XAMPP database management skills together! Basic Database Operations in XAMPP Basic Database Operations in XAMPP include performing CRUD operations such as select, insert, update, and delete statements on a MySQL database using PHP. ...

Read More

Setting Up Nginx with MariaDB and PHP/PHP-FPM on Fedora 24 Server and Workstation

Ayush Singh
Ayush Singh
Updated on 15-Mar-2026 547 Views

Hosting websites and online applications requires setting up a web server infrastructure. In this article, we'll understand how to set up Nginx on Fedora 24 Server and Workstation using MariaDB and PHP/PHP-FPM. This combination creates a powerful LEMP stack for managing databases and serving dynamic content. Note: Fedora 24 is an older version that no longer receives security updates. For production environments, consider using a current Fedora version or other long-term support distributions. Installation Prerequisites Before starting, ensure your system is updated and you have root privileges. We'll install the LEMP stack components step by ...

Read More

Setting Up LEMP Linux, Nginx, MySQL/MariaDB, PHP) and PhpMyAdmin on Ubuntu 15.04 Server

Ayush Singh
Ayush Singh
Updated on 15-Mar-2026 495 Views

LEMP stack is a powerful combination of open source technologies used for web development and hosting. LEMP comprises Linux (the operating system), Nginx (pronounced "engine-x", a web server), MySQL/MariaDB (database management), and PHP (server-side scripting language). Note: Ubuntu 15.04 has reached end-of-life. This guide is for educational purposes. Consider using a current Ubuntu LTS version for production environments. Prerequisites Before starting the installation, ensure you have − Ubuntu 15.04 server with root or sudo access Internet connection for package downloads Basic command line knowledge Manual Installation Method Step 1: Update ...

Read More

Setting Up LAMP (Linux, Apache, MariaDB and PHP) on Fedora 24 Server

Ayush Singh
Ayush Singh
Updated on 15-Mar-2026 433 Views

Follow these instructions to install LAMP (Linux, Apache, MariaDB, and PHP) on a Fedora 24 server. LAMP stack provides a complete web development environment with Linux as the operating system, Apache as the web server, MariaDB as the database, and PHP for server-side scripting. Prerequisites: Ensure you have a fresh Fedora 24 server installation with root or sudo access and an active internet connection. Step 1: Update System First, update your system packages to ensure you have the latest versions ? sudo dnf update -y Step 2: Install Apache Web Server ...

Read More
Showing 11–20 of 802 articles
« Prev 1 2 3 4 5 81 Next »
Advertisements