This is a simple calculator project built with PHP, HTML, CSS, and JavaScript. It allows users to perform basic arithmetic operations like addition, subtraction, multiplication, and division.
- User can input two numbers and select an operator.
- The calculator performs the selected operation and displays the result.
- Error handling for empty fields, non-numeric input, and division by zero.
- Improved user interface and user experience with JavaScript enhancements.
To get a local copy of this project, follow these steps:
- Clone the repository:
git clone https://github.com/chouaib-629/calculator_php.git
- Navigate to the project directory:
cd calculator_php
- Open the
index.php
file in your preferred web browser.
To use the calculator, follow these steps:
- Enter the first number in the first input field.
- Select an operator from the dropdown menu.
- Enter the second number in the second input field.
- Click the "Calculate" button to see the result.
index.php
: The main file containing the HTML, CSS, and PHP code for the calculator.css/style_1.css
: The default stylesheet for the calculator.css/style_2.css
: An alternative stylesheet with a different visual design.css/style_3.css
: Another alternative stylesheet with a unique visual design.js/script.js
: The JavaScript file containing code for enhanced user interface and experience.
To switch between the three available styles, simply update the link
tag in the index.php
file to point to the desired stylesheet. For example:
- To use
style_1.css
, use:
<link rel="stylesheet" href="css/style_1.css">
- To use
style_2.css
, use`
<link rel="stylesheet" href="css/style_2.css">
- To use
style_3.css
, use:
<link rel="stylesheet" href="css/style_3.css">
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.