ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalITEC3111Php
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    ITEC3111

    Web Engineering

    Progress0 / 24 done
    Topics24
    1Web programming languages (HTML5, CSS3, JavaScript, PHP/JSP/ASP.Net)2HTML53CSS34JavaScript5PHP6JSP7ASP.Net8Design principles of Web based applications9Web platform constraints10Software as a Service (SaaS)11Web standards12Responsive Web Design13Web Applications14Browser/Server Communication15Storage Tier16Cookies and Sessions17Input Validation18Full stack state management19Web App Security - Browser Isolation20Network Attacks and Session Attacks21Large scale applications22Performance of Web Applications23Data Centers24Web Testing and Web Maintenance
    3 min read
    Topic 5 of 24
    Topic Study Note Illustration
    05

    PHP

    PHP is a server-side scripting language used to create dynamic and interactive web pages . It runs on the web server and sends processed output (HTML) to...

    🐘 PHP (Hypertext Preprocessor)


    📌 1. Definition

    PHP is a server-side scripting language used to create dynamic and interactive web pages. It runs on the web server and sends processed output (HTML) to the browser.


    🌐 2. How PHP Works (Diagram Description)

    👉 Draw this in exam:

    Browser → Request → Web Server (PHP Code)
                     ↓
               Process Logic
                     ↓
              Send HTML Response → Browser
    

    ✔ PHP code is executed on server, not visible to user.


    🧱 3. Basic PHP Syntax

    <?php
    echo "Hello World";
    ?>
    

    🔑 Key Points

    • PHP code starts with <?php and ends with ?>
    • Each statement ends with ;
    • echo is used to display output

    🧠 4. Variables in PHP

    📌 Definition

    Variables store data values.

    <?php
    $name = "Ali";
    $age = 20;
    ?>
    

    ⭐ Rules

    • Starts with $
    • Case-sensitive
    • No need to declare data type

    🔢 5. Data Types

    • String
    • Integer
    • Float
    • Boolean
    • Array
    • Object
    • NULL

    ➕ 6. Operators

    • Arithmetic: + - * / %
    • Assignment: =
    • Comparison: == != > <
    • Logical: && || !
    <?php
    $x = 10 + 5;
    ?>
    

    🔀 7. Control Statements

    1. If-Else

    <?php
    if ($x > 10) {
      echo "Greater";
    } else {
      echo "Smaller";
    }
    ?>
    

    2. Loops

    <?php
    for ($i = 0; $i < 5; $i++) {
      echo $i;
    }
    ?>
    

    🔧 8. Functions

    <?php
    function greet() {
      echo "Hello!";
    }
    greet();
    ?>
    

    🌍 9. Forms Handling (Important)

    HTML Form

    <form method="post">
      Name: <input type="text" name="name">
      <input type="submit">
    </form>
    

    PHP Processing

    <?php
    $name = $_POST['name'];
    echo $name;
    ?>
    

    🗄️ 10. Working with Database (MySQL)

    <?php
    $conn = mysqli_connect("localhost", "root", "", "test");
    ?>
    

    🔑 Steps

    1. Connect database
    2. Execute query
    3. Fetch data

    📂 11. Superglobals (Important)

    • $_GET
    • $_POST
    • $_SERVER
    • $_SESSION
    • $_COOKIE

    🔐 12. Sessions & Cookies

    Session Example

    <?php
    session_start();
    $_SESSION["user"] = "Ali";
    ?>
    

    Cookie Example

    <?php
    setcookie("user", "Ali", time()+3600);
    ?>
    

    📊 13. PHP Execution Flow

    User Request → Server → PHP Execution → Database → Response (HTML)
    

    ⚠️ 14. Important Rules

    ✔ PHP runs on server-side ✔ File extension is .php ✔ Can be embedded in HTML ✔ Use $_POST for secure data transfer ✔ Always validate user input


    📈 15. Advantages

    • Open-source
    • Easy to learn
    • Database support
    • Platform-independent
    • Fast execution

    ❌ 16. Limitations

    • Less secure if not coded properly
    • Slower than some modern frameworks
    • Mixing HTML & PHP can reduce readability

    ❓ 17. Likely Exam Questions

    Short Questions

    1. Define PHP.
    2. What are PHP variables?
    3. List PHP data types.
    4. What are superglobals?
    5. What is session?

    Long Questions

    1. Explain PHP syntax with example.
    2. Describe form handling in PHP.
    3. Explain PHP with database connectivity.
    4. Discuss sessions and cookies.
    5. Compare PHP with JavaScript.

    📝 18. Summary / Quick Revision

    • PHP = Server-side language

    • Used for:

      • Dynamic pages
      • Form handling
      • Database interaction
    • Key features:

      • Variables ($)
      • Superglobals
      • Sessions & Cookies

    👉 Works with HTML + CSS + JavaScript to build full web applications.


    ← Previous topic 4
    JavaScript
    Next topic 6 →
    JSP

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    3mremaining
    530words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Web Engineering