Posts

Practical - 4 IWD

 AIM :  Write a script to perform 3x3 matrix Multiplication. 3×3 Matrix Multiplication using PHP 📌 Theory (For Exam) Matrix multiplication is possible only if Number of columns of Matrix A = Number of rows of Matrix B For 3×3 matrices , the result is also a 3×3 matrix Formula used: C [ i ] [ j ] = ∑ k = 0 2 A [ i ] [ k ] × B [ k ] [ j ] C[i][j] = \sum_{k=0}^{2} A[i][k] \times B[k][j] C [ i ] [ j ] = k = 0 ∑ 2 ​ A [ i ] [ k ] × B [ k ] [ j ] ✅ PHP Script for 3×3 Matrix Multiplication <?php // Define first 3x3 matrix $A = array ( array ( 1 , 2 , 3 ), array ( 4 , 5 , 6 ), array ( 7 , 8 , 9 ) ); // Define second 3x3 matrix $B = array ( array ( 9 , 8 , 7 ), array ( 6 , 5 , 4 ), array ( 3 , 2 , 1 ) ); // Initialize result matrix with zeros $result = array ( array ( 0 , 0 , 0 ), array ( 0 , 0 , 0 ), array ( 0 , 0 , 0 ) ); // Matrix multiplication logic for ( $i = 0 ; $i < 3 ; $i ++) { for ( $j = 0 ; $j ...

Practical - 3 IWD

 Aim : Write a script to   read the marks of 4 subjects and display the result as per the below instructions: GTUGRADE Mark-Range AA 85-100 AB 75-8 BB 65-74 BC 55-64 CC 45-54 CD 40-44 DD 35-39 FF <35(FAIL) a.        Eachofthefoursubjectsisworth100 M arks. b.       If a student gets less than 35 marks in any subject, then he/she will be marked as FAIL, otherwise he/she will be marked as PASS. The result contains the grade of each individual subject in tabular format as per the above table. File Name :gtugrade.php PHP Script: GTU Result Calculation <?php // Function to calculate grade based on marks function getGrade ( $marks ) { if ( $marks >= 85 && $marks <= 100 ) return "AA" ; e...

Practical - 2 IWD

  Aim To write a PHP script to implement a simple calculator that performs basic mathematical operations. Algorithm Declare two numbers. Select the required mathematical operation. Perform the calculation using operators. Display the result. Program Code (PHP Script) <?php // Declare variables $a = 20 ; $b = 10 ; // Addition $add = $a + $b ; // Subtraction $sub = $a - $b ; // Multiplication $mul = $a * $b ; // Division $div = $a / $b ; // Display results echo "Addition: " . $add . "<br>" ; echo "Subtraction: " . $sub . "<br>" ; echo "Multiplication: " . $mul . "<br>" ; echo "Division: " . $div ; ?> Output Addition: 30 Subtraction: 10 Multiplication: 200 Division: 2 Result The PHP script successfully performed addition, subtraction, multiplication, and division using a simple calculator logic. Viva-Related Questions Which op...

Practical - 1 IWD

  Aim To install and configure PHP, Web Server, and MySQL database using XAMPP / WAMP / LAMP / MAMP and create a web page to display “Hello World” . Software Required XAMPP / WAMP / LAMP / MAMP Web Browser (Chrome / Firefox) Text Editor (Notepad / VS Code) Theory PHP is a server-side scripting language. Apache is a web server. MySQL is a relational database. XAMPP / WAMP / LAMP / MAMP are software packages that provide: Web Server (Apache) PHP MySQL phpMyAdmin Installation and Configuration Steps Using XAMPP (Windows / Linux / macOS) Step 1: Download XAMPP Download XAMPP installer from official website. Run the installer and select: Apache MySQL PHP phpMyAdmin Step 2: Install XAMPP Follow installation wizard. Default installation path: C:\xampp\ Step 3: Start Services Open XAMPP Control Panel Start: Apache MySQL ✔ Green indicator confirms successful start. Step 4: Verify Ins...

Unit I - Introduction to PHP

  1. Introduction to PHP 1.1 Introduction to Static and Dynamic Websites Static Website Content is fixed and does not change automatically. Created using HTML and CSS . Same content is shown to all users. Example: A college notice page written only in HTML. < h1 >Welcome to Our College </ h1 > < p >Admission Open </ p > Dynamic Website Content changes based on user interaction or database. Uses server-side languages like PHP . Can display different data to different users. Example: Login system, online result system, feedback form. 1.2 Introduction to PHP and Its History PHP stands for Hypertext Preprocessor . It is a server-side scripting language . PHP code runs on the server and sends output to the browser as HTML. History of PHP Created by Rasmus Lerdorf in 1994 . Initially called Personal Home Page . Later developed into a powerful web development language. Widely used with MySQL for database-d...