Simple calculator - created with HTML, PHP and CSS and made to look like a real calculator, with buttons, 2-display,etc. (No JS)
I noticed that most calculator created with PHP doesn't actually look and behave like a really calculator and I challenged myself to create something that will, I hoped to find something simple to just recreate, after doing my research, I was shocked that I couldn't find any one with just html and php, most of them were create with js, jqueryy, Ajax, and I wanted it to be purely PHP and at most HTML to create the form.
- How does a regular PHP calculator look like?
- A form field to input data 1
- A form selection to choose the operation "+,-,/,*
- Another form field to input data 2
- Displayed answer after data is submitted
- Limited to have one calculation at a time
That is actually the basic of a calculator, but I wanted something that actually looked and feel like a calculator
How does a real calculator feel and look like? (The Goal)
- Data input by buttons
- Display that shows all the data together
- Display the shows the data as they are typed/clicked
- Actual looks of a calculator
- Freedom to input as much mathematical calculation expression, eg, " 5*5+8-8/2 "
Gladly all of my goal for the project was achieved and more, here are other goals that I was able to acheive
- Actual calculator look and feel
- Convert inputs from string to mathematical expression and output the answer
- Saves the question from display and shows it again white the answer below (2-display calculator)
- Write code to display error for various input that are natural not mathematical express, such as empty fields, syntax error, input error, etc
- Limit output to 12 characters
- And so much more that a simple calculator has
There are however something(s) I wish I could achieve
- Limit data input to 13 characters when inputting data by buttons (The limitation works when you input data by typing in the actual form - The top part of the display is an actual form field.
view live site here - https://cheche-php-calculator.herokuapp.com/ What do you think?