Posted by Tyno Gendo on 10/10/07 12:44
Tyno Gendo wrote:
> OR something like that....
>
> just curious why ;-)
>
> ... and now someone will point a really easy way to do it and as well
> and i'll look a fool... LOL
I noticed a few typos after I'd typed it into my email, cut and paste
into nusphere to see if it ran... so here is adjusted version with
corrected var names... I'm still curious.. why ? ;-)
class CVar {
protected $var_name = '';
protected $var_value = '';
public function __construct( $name = '', $value = '' ) {
$this->var_name = $name;
$this->var_value = $value;
}
public function getName() { return $this->var_name; }
public function getValue() { return $this->var_value; }
public function setName($name) { $this->var_name = $name; }
public function setValue($value){ $this->var_value = $value; }
}
function foo($bar) {
return $bar->getName();
}
$myvar = new CVar('animal','dog');
echo foo( $myvar );
Navigation:
[Reply to this message]
|