PHP Articles

Page 9 of 81

PHP program to Count Inversions of size three in a given array

Rudradev Das
Rudradev Das
Updated on 15-Mar-2026 281 Views

Inversion count is a measure that determines how far an array is from being sorted. For inversions of size three, we look for triplets (i, j, k) where a[i] > a[j] > a[k] and i < j < k. This helps analyze the sorting complexity of an array. Array: {5, 4, 3, 2, 1} // reverse order Triplets: (5, 4, 3), (5, 4, 2), (5, 4, 1), (5, 3, 2), (5, 3, 1), (5, 2, 1), (4, 3, 2), (4, 3, 1), (4, 2, 1), (3, 2, 1) Output: 10 Array: {1, 2, 3, 4, 5} ...

Read More

Should I Learn Python or PHP for the Back End?

Tushar Sharma
Tushar Sharma
Updated on 15-Mar-2026 468 Views

Choosing between Python and PHP for backend development is one of the most common decisions new developers face. Both languages have established themselves as powerful tools for server-side programming, but they serve different purposes and excel in different areas. PHP was specifically designed for web development and has powered millions of websites since the 1990s. Python, originally created for general-purpose programming, has gained significant traction in web development while maintaining its dominance in data science and machine learning. Understanding their key differences will help you make an informed decision based on your career goals and project requirements. ...

Read More

PDF generation from XHTML in a LAMP environment

Satish Kumar
Satish Kumar
Updated on 15-Mar-2026 394 Views

The LAMP environment is widely used for web development, and it is an acronym for Linux, Apache, MySQL, and PHP. This environment is an open-source platform that is easy to use and deploy. PDF format is commonly used for sharing and exchanging documents over internet. However, generating PDF documents can be a challenging task in a LAMP environment, especially when converting XHTML documents. In this article, we will explore different methods used for PDF generation from XHTML in a LAMP environment. What is XHTML? XHTML stands for Extensible Hypertext Markup Language, which is a markup language that is ...

Read More

PHP and Xvfb usage

Satish Kumar
Satish Kumar
Updated on 15-Mar-2026 1K+ Views

Xvfb (X Virtual Frame Buffer) creates a virtual display in memory without requiring physical display hardware. This allows running graphical applications in a headless environment. When combined with PHP, Xvfb enables server−side execution of GUI applications through PHP scripts. Why Use Xvfb with PHP? PHP typically handles server−side logic without direct graphics support. However, certain scenarios require running graphical applications on servers − Automated testing of GUI applications Browser automation for web scraping Image/video processing with graphical tools Running desktop applications headlessly Installation Ubuntu/Debian: sudo apt-get update sudo apt-get install xvfb ...

Read More

How to add more values to the array on a button click using PHP?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 5K+ Views

Adding more values to an array on a button click in PHP requires combining PHP server-side processing with HTML forms. This functionality is essential for creating dynamic web applications where users can modify array data through user interactions. Using HTML Forms The most straightforward approach uses an HTML form to submit new values to PHP, which then adds them to the array ? Add Values to Array ...

Read More

How does Python compare to PHP in ease of learning for new programmers?

Vikram Chiluka
Vikram Chiluka
Updated on 15-Mar-2026 353 Views

When comparing Python and PHP for new programmers, both languages offer unique advantages, but they differ significantly in learning curve, syntax clarity, and career opportunities. Let's explore how these languages compare for beginners. Python: Beginner-Friendly Design Python is widely regarded as an excellent first programming language due to its emphasis on readability and clean coding practices. Key Advantages for Beginners Python enforces proper coding techniques through mandatory indentation, making code naturally readable and well-structured. It's strongly typed, preventing common beginner mistakes like mixing incompatible data types. The language's syntax is intuitive and closely resembles natural English. ...

Read More

How to make Laravel (Blade) text field read-only?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 2K+ Views

In Laravel Blade templates, you can make text fields read-only using Laravel's Form facade or plain HTML input elements. This prevents users from editing the field while still displaying the value. Installation: For Laravel Form facade, install the package: composer require laravelcollective/html Setting up Routes and Views First, let's create a basic route that passes data to our Blade template − Create hello.blade.php in the resources/views/ folder − {{ $mymsg }} Welcome to Tutorialspoint Using Laravel Form Facade The Form facade provides ...

Read More

How to remove a parameter from all Request Objects at Controller Level in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 5K+ Views

In Laravel, you can remove specific parameters from Request objects in your controller using several methods. This is useful for filtering unwanted data before processing or validation. Using unset() Method The simplest approach is using PHP's built−in unset() function to remove parameters directly from the request object ? Array ( [_token] => nUXVJ5adsFLADKC9RCbAJcdfYCRquy8GUkUCXtR8 [name] => Rasika Desai [email] => rasika@gmail.com [age] => 20 [address] => Pune ) Array ( [_token] => nUXVJ5adsFLADKC9RCbAJcdfYCRquy8GUkUCXtR8 ...

Read More

How to validate aninput field if the value is not NULL in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 3K+ Views

In Laravel, you can validate input fields to ensure they are not NULL using the Validation class. The required rule is the most common way to validate that a field is not null or empty. Basic Validation Syntax The Validator::make() method takes two arguments − the data to validate and the validation rules ? In this example, the name field is required and must have at least 5 characters. Complete Validation Example Here's a complete controller example that validates multiple fields for non-null values ? ...

Read More

How to validate exact words in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 3K+ Views

Laravel provides several methods to validate exact words in your application. The most common approaches include using Rule::in method, in: validation rule, and regular expressions for precise word matching. Using Rule::in Method The Rule::in method validates that the field value matches one of the specified values exactly. To use this method, you need to import the Rule class ? Make sure to include: use Illuminate\Validation\Rule; at the top of your file. Here the input array has category values ABC and XYZ, but Rule::in expects ABC and TIK. Since XYZ doesn't ...

Read More
Showing 81–90 of 802 articles
« Prev 1 7 8 9 10 11 81 Next »
Advertisements