PHP Classes

PHP CLI Calculator Class: Perform calculations with values from the console

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 136 All time: 9,263 This week: 206Up
Version License PHP version Categories
php-cli-calculator-c 1.0MIT/X Consortium ...5PHP 5, Console, Math


This class can perform calculations with values from the console.

It can read the user input from the shell console to perform several types of math operations.

First the class reads the input to take one letter that defines which operation will be performed.

Then the class calls the respective operation function to take additional parameters to perform the specified math operation.

Currently it can perform the operations: addition, subtraction, multiplication, division, remainder and percentage.

Innovation Award
PHP Programming Innovation award nominee
October 2018
Number 9
Sometimes it is necessary to perform simple math calculations.

This class allows users to make calculations on a command line console using a simple script that uses the class.

Manuel Lemos
Picture of Muhammad Umer Farooq
Name: Muhammad Umer Farooq is available for providing paid consulting. Contact Muhammad Umer Farooq .
Classes: 52 packages by
Country: Pakistan Pakistan
Age: 22
All time rank: 84411 in Pakistan Pakistan
Week rank: 280 Up6 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 6x




require_once 'class/CliCalculator.php';



PHP CLI Calculator Class

Its my own implementation of calculator using php-cli Support many feature.. 1. Addition 2. subtraction 3. Average 4. Multiplication and much more


  • PHP

How to use

just type command in terminal `php CAL` then follow the instruction

  Files folder image Files  
File Role Description
Files folder imageclass (1 file)
Accessible without login Plain text file CAL Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  class  
File Role Description
  Plain text file CliCalculator.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,263
This week:206Up