Paul Scott wrote:
On Wed, 2007-04-11 at 23:22 -0700, Jim Lucas wrote:
Has anybody else seen this style of syntax?
http://5ive.uwc.ac.za/index.php?module=blog&action=viewsingle&postid=init_8059_1163957717&userid=5729061010
I don't think that its really useful for anything, except maybe creating
overly complex SQL queries.
--Paul
------------------------------------------------------------------------
All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm
What about using it for math?
Here is the other example that I worked up.
<plaintext><?php
class Math {
function __construct() {
}
function in($num=null) {
if ( is_null($num) ) {
echo "A number was not given on initialization.";
exit;
}
$this->value = $num;
return $this;
}
function out() {
echo $this->value;
}
function get() {
return $this->value;
}
function add($n) {
$this->value += $n;
return $this;
}
function subtract($n) {
$this->value -= $n;
return $this;
}
function multiply($n) {
$this->value *= $n;
return $this;
}
function divide($n) {
$this->value /= $n;
return $this;
}
}
$mObj = new Math();
$mObj->in(10)->add(90)->divide(5.3)->multiply(10)->out();
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php