Posted by m6s on 01/07/06 13:42
m6s wrote:
> function getPrice( $sbl ){
> if ( $sbl == $this->$paper[symbol] ){
> return $this->$paper[price];
> }
>
> }
> }
> echo "Building a stock object....\n";
> $sg = new Stocks();
> $sg->setSymbol( "fdas" );
> $sg->setPrice( "100" );
> echo "Stock :".$sg->getPrice( "fdas" );
>
> The getPrice returns nothing...
> I don't understand why... The function resides in a class, as method of
> an object.
Also I did this:
var $paper = array( rec,symbol, price );
function setSymbol( $stk ){$this->$paper[symbol] = $stk;}
function setPrice( $prc ){$this->$paper[price] = $prc;}
So when I pass a symbol, I want to initiate a new array and then fill it
up with data...
I use setSymbol->("bla")
setPrice->("100");
so if the symbol is bla then the price is 100 else return null, nothing...
I think it like that and try to implement it like that...with arrays
holded in this class....
[Back to original message]
|