Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🚀 PHP Exercises Suite — Fundamentals, Logic & Algorithms

PHP XAMPP HTML5 Status Level

📚 A professional PHP practice project focused on algorithms, control structures, HTML forms, and dynamic output


📖 Overview

This repository contains a structured set of PHP exercises designed to strengthen the fundamentals of programming through practical mini-projects.

The project explores key concepts such as:

  • variables and constants
  • forms with POST
  • arithmetic processing
  • conditions with if / elseif / else
  • selection with switch
  • loops with for, while, and foreach
  • arrays and indexed traversal
  • mathematical logic
  • pattern generation using nested loops
  • Fibonacci sequence generation

The codebase is ideal for a student learning how to move from simple syntax to algorithmic reasoning in PHP.


🎯 Pedagogical Objectives

This project was built to practice and demonstrate the ability to:

  • understand the core syntax of PHP
  • process user input from HTML forms
  • manipulate numbers, arrays, and strings
  • apply decision-making logic in real cases
  • use loops efficiently for repetitive tasks
  • generate visual patterns algorithmically
  • implement mathematical sequences such as Fibonacci
  • write clean educational code for academic presentation

🧠 What This Project Covers

1) Student Information & Grade Processing

The file Exercice1_2.php handles a form-based student exercise where the user enters personal information and grades, then the program computes:

  • total score
  • average
  • mention / appreciation
  • admission result
  • major or minor status
  • display of notes using different loop structures
  • association of subjects with grades using arrays

2) Multiplication, Patterns & Number Logic

The file Patterns.php focuses on algorithmic printing and number processing:

  • multiplication table
  • centered triangle pattern
  • square pattern
  • even number display
  • sum of integers from 1 to n
  • parity test (even / odd)

3) Fibonacci Sequence

The file Fibonacci.php implements the Fibonacci sequence:

  • iterative approach for performance and clarity
  • optional recursive version kept as reference/commented logic

📂 Project Structure

php-exercises/
│
├── Exercice1_2.php      # Student form, grades, average, mention, loops, arrays
├── Fibonacci.php      # Fibonacci sequence generation
├── Patterns.php       # Multiplication table, patterns, parity, sums
└── README.md          # Project documentation

⚙️ Technologies Used

  • PHP
  • HTML5
  • XAMPP
  • Apache Local Server
  • VS Code / any code editor

🔍 Detailed Features

Exercice1_2.php

  • HTML form for:
    • first name
    • last name
    • age
    • three grades
  • average and sum calculation
  • mention classification:
    • Excellente
    • Bien
    • Assez bien
    • Passable
    • Échec
  • admission decision
  • age category:
    • majeur
    • mineur
  • display with:
    • for
    • while
    • foreach
  • mapping subject names to marks

Patterns.php

  • multiplication table generation
  • centered triangle with stars
  • square pattern
  • even numbers extraction
  • sum of first integers:
    • iterative method
    • mathematical formula
  • odd/even check

Fibonacci.php

  • Fibonacci sequence from F0 upward
  • efficient iterative construction
  • recursive version shown as algorithmic alternative

🖥️ How to Run the Project Locally

1. Place the project inside XAMPP

Copy the folder into:

C:\xampp\htdocs\

So the final path becomes:

C:\xampp\htdocs\php-exercises

2. Start Apache

Open XAMPP Control Panel and start:

  • Apache

3. Open the files in the browser

Use one of these URLs:

http://localhost/php-exercises/Exercice1_2.php
http://localhost/php-exercises/Patterns.php
http://localhost/php-exercises/Fibonacci.php

🚀 GitHub Installation / Clone

To clone and use the project later:

git clone https://github.com/KHALIDMRJ/php-exercises.git
cd php-exercises

Then move it into your local server folder if needed.


🧪 Example Learning Outcomes

After completing this project, a student should be able to:

  • create a PHP form and retrieve values with $_POST
  • use constants and variables correctly
  • structure conditional logic cleanly
  • compare loops and know when to use each one
  • generate console-like and browser-based outputs
  • solve mathematical problems with PHP
  • understand iterative vs recursive thinking

🏆 Why This Project Is Valuable Academically

This repository is not just a collection of exercises.
It shows progression from basic syntax to real algorithmic thinking.

It demonstrates:

  • practical use of PHP fundamentals
  • clean decomposition of exercises by theme
  • direct relation between theory and implementation
  • readiness for lab work, viva explanation, and teacher evaluation

For an academic presentation, this project can be explained as:

A structured PHP training suite designed to reinforce programming logic, form processing, algorithmic reasoning, and problem-solving through practical exercises.


💡 Suggested Improvements for Future Versions

To make the project even stronger in future iterations, you can add:

  • CSS styling for better UI
  • separated header/footer files
  • reusable PHP functions
  • input validation and sanitization
  • session handling
  • modular project structure
  • screenshots in the README
  • French/English bilingual documentation

👨‍💻 Author

Khalid Morjane
Student in Systèmes d’Information & Intelligence Artificielle


📜 License

This project is intended for educational and academic use.


⭐ Final Note

If you found this project useful, consider adding a star on GitHub to support the work and keep improving the repository.

About

Professional PHP exercises project covering forms, loops, conditions, arrays, patterns, and Fibonacci sequence.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages