{"id":20515224,"url":"https://github.com/sathirasrisathsara/php-calculator-app","last_synced_at":"2026-06-01T03:31:42.567Z","repository":{"id":247202814,"uuid":"825258409","full_name":"SathiraSriSathsara/php-calculator-app","owner":"SathiraSriSathsara","description":"A simple web-based calculator built using PHP and HTML","archived":false,"fork":false,"pushed_at":"2024-07-07T09:30:38.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T23:21:41.602Z","etag":null,"topics":["calculator","html","php","web"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SathiraSriSathsara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-07T09:22:04.000Z","updated_at":"2024-07-07T09:31:32.000Z","dependencies_parsed_at":"2024-07-07T10:55:49.826Z","dependency_job_id":null,"html_url":"https://github.com/SathiraSriSathsara/php-calculator-app","commit_stats":null,"previous_names":["sathirasrisathsara/php-calculator-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SathiraSriSathsara/php-calculator-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SathiraSriSathsara%2Fphp-calculator-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SathiraSriSathsara%2Fphp-calculator-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SathiraSriSathsara%2Fphp-calculator-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SathiraSriSathsara%2Fphp-calculator-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SathiraSriSathsara","download_url":"https://codeload.github.com/SathiraSriSathsara/php-calculator-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SathiraSriSathsara%2Fphp-calculator-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33759178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calculator","html","php","web"],"created_at":"2024-11-15T21:20:17.980Z","updated_at":"2026-06-01T03:31:42.549Z","avatar_url":"https://github.com/SathiraSriSathsara.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Calculator\n\nThis project is a simple web-based calculator built using PHP and HTML. It allows users to perform basic arithmetic operations like addition, subtraction, multiplication, and division. This README file will guide you through the structure and usage of the code.\n\n![image](./screenshots/ss.png)\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [File Structure](#file-structure)\n4. [Code Overview](#code-overview)\n\n## Installation\n\n1. **Clone the Repository:**\n   ```bash\n   git clone https://github.com/SathiraSriSathsara/php-calculator-app.git\n   cd php-calculator-app\n   ```\n\n2. **Ensure you have a local server setup:**\n   - Install XAMPP, WAMP, or any other local server solution.\n   - Move the cloned repository to the server's root directory (e.g., `htdocs` for XAMPP).\n\n3. **Start the local server:**\n   - Open the control panel for your server solution and start the Apache server.\n\n4. **Access the Calculator:**\n   - Open your web browser and navigate to `http://localhost/php-calculator-app` (assuming the folder is named `php-calculator-app`).\n\n## Usage\n\n1. **Open the Calculator in a Web Browser:**\n   - Navigate to the URL where the calculator is hosted on your local server.\n\n2. **Perform Calculations:**\n   - Enter the first number in the \"First Number\" input field.\n   - Enter the second number in the \"Second Number\" input field.\n   - Click on one of the operation buttons (`+`, `-`, `x`, `/`) to perform the respective operation.\n   - The result will be displayed on the screen.\n   - Click on `AC` to clear the result.\n   - Click on `C` to reset the input fields.\n\n## File Structure\n\nThe project directory contains the following files and folders:\n\n```\nphp-calculator/\n│\n├── app/\n│   └── logic.php\n│\n├── style/\n│   └── style.css\n│\n└── index.html\n```\n\n- **app/logic.php:** Contains the PHP logic for performing arithmetic operations.\n- **style/style.css:** Contains the CSS for styling the calculator.\n- **index.html:** The main HTML file that renders the calculator interface.\n\n## Code Overview\n\n### index.html\n\nThe `index.html` file contains the structure of the calculator interface. It includes the following key sections:\n\n- **Head Section:**\n  ```html\n  \u003chead\u003e\n      \u003cmeta charset=\"UTF-8\"\u003e\n      \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n      \u003clink rel=\"stylesheet\" href=\"./style/style.css\"\u003e\n      \u003ctitle\u003eCalculator by Sathira Sri Sathsara\u003c/title\u003e\n  \u003c/head\u003e\n  ```\n\n- **Form Section:**\n  ```html\n  \u003cform method=\"post\"\u003e\n      \u003cdiv class=\"center cal\"\u003e\n          \u003cdiv class=\"rectangle\"\u003e\n              \u003c?php \n              include './app/logic.php';\n              echo '\u003clabel class=\"output\"\u003e'.$result.'\u003c/label\u003e';\n              if(isset($_POST[\"allClear\"])){\n                  $result = '';\n                  echo '\u003clabel class=\"output\"\u003e'.$result.'\u003c/label\u003e';\n              }\n              ?\u003e\n          \u003c/div\u003e\n          \u003cdiv class=\"top\"\u003e\n              \u003clabel class=\"firstNumber\"\u003eFirst Number\u003c/label\u003e\n              \u003cinput type=\"number\" name=\"numb01\"\u003e\n              \u003clabel class=\"secondNumber\"\u003eSecond Number\u003c/label\u003e\n              \u003cinput type=\"number\" name=\"numb02\"\u003e\n          \u003c/div\u003e\n          \u003cdiv class=\"btns\"\u003e\n              \u003cinput type=\"submit\" name=\"addition\" value=\"+\"\u003e\n              \u003cinput type=\"submit\" name=\"subtraction\" value=\"-\"\u003e\n              \u003cinput type=\"submit\" name=\"multiplication\" value=\"x\"\u003e\n              \u003cinput type=\"submit\" name=\"division\" value=\"/\"\u003e\n              \u003cinput type=\"submit\" name=\"allClear\" value=\"AC\"\u003e\n              \u003cinput type=\"reset\" value=\"C\"\u003e\n          \u003c/div\u003e\n      \u003c/div\u003e\n  \u003c/form\u003e\n  ```\n\n### logic.php\n\nThe `logic.php` file includes the logic for performing the arithmetic operations based on the user inputs. It reads the inputs, performs the calculations, and stores the result in the `$result` variable, which is then displayed in the `index.html` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsathirasrisathsara%2Fphp-calculator-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsathirasrisathsara%2Fphp-calculator-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsathirasrisathsara%2Fphp-calculator-app/lists"}