PHP Classes

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

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

Author

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: 23
All time rank: 84310 in Pakistan Pakistan
Week rank: 24 Up1 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 6x

Example

#!/usr/bin/php

<?php

require_once 'class/CliCalculator.php';

(new
CliCalculator())->run();


Details

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

Requirement

  • PHP

How to use

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


  Files folder image Files (4)  
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 readme.md Doc. Documentation

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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:136
This week:0
All time:9,271
This week:206Up