Work sample

Server-side calculator (vanilla PHP)

This is a work sample I completed for a prospective employer

I was handed a HTML template and asked to program it to do various tasks.

Tasks

  • enable the calculator to perform 2 fundamental arithmetic operations (add, subtract, divide, multiply) on positive integers
  • entering numbers with more than one digit should perform like a "real" calculator, meaning that numbers should move to the left when new ones appear
  • performing multiple consecutive operations on numbers should be possible while displaying the current intermediate result in the display
  • the buttons "C" (clear) and "=" (Show result) should perform as expected
  • the code should be structured in a way that makes future enhancements and additional functions easy to implement

Restrictions

  • no JS nor cookies are to be used