Simple Calculator Library |
[eluser]phpserver[/eluser]
I have a small calculator application here it is: Library:Calculator.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Controller:Calculate.php Code: <?php
[eluser]Sbioko[/eluser]
I'm not actually understand, what this library for? It's just a wrapper for the native php functions. And, please, it is funny: Code: function add( $num1, $num2) Code: function add() {
[eluser]Sbioko[/eluser]
Oh, and what's this: Code: $calca = new Calculator(); Code: $this->calculator->some_func();
[eluser]Phil Sturgeon[/eluser]
[quote author="Sbioko" date="1266007436"]I'm not actually understand, what this library for? It's just a wrapper for the native php functions. And, please, it is funny: Code: function add( $num1, $num2) Code: function add() { While we are optimizing code: Code: function add() { But yeah, this is pretty f**king pointless.
[eluser]Sbioko[/eluser]
Phil, I showed this code just for example. Without any optimising and validating. I agree with you, I don't understand the meaning of this library.
[eluser]phpserver[/eluser]
Code: $calca = new Calculator();
[eluser]Sbioko[/eluser]
Quote:sbioko is a new instance of the class calculatorHaha :-) I know that this is the new instance of the calculator's class. I just adviced you to use $this->calculator.
|
Welcome Guest, Not a member yet? Register Sign In |