Date: 05/05/00
- Next message: chris <email protected>: "[PHP-DEV] PHP 4.0 Bug #4338: Header in HTML stream"
- Previous message: daniel.lashua <email protected>: "[PHP-DEV] Bug #4337: Informix ifx_get_blob() causes SIGSEGV in Apache 1.3.9"
- In reply to: Bocskai Stefan: "[PHP-DEV] CLASS Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I know this isn't going to be much of a help but if you move the
assignment of $this->table["ABC"] into the constructor, you will be able
to reference it.
As for referencing table in a member func, could it be that the scope of
$u is lost when the recursive func unwinds? This might be the case since
referencing table with $test->table["ABC"] is possible.
Just a thought
On Fri, 5 May 2000, Bocskai Stefan wrote:
>
>
> Hi,
> I'm a beginer in PHP and I already have a greate problem with the classes:
>
> Please see this example:
>
> <?
>
> class xx{
> var $child;
> var $table = array();
> var $i;
>
> function xx($i){
> $this->i = $i;
> if ($i<10) $this->child = new xx($i+1);
>
> }// end of constructor
>
>
> function propag()
> {
> // this function is auto porpaging into objects
> // and set the value of $table["ABC"];
> $this->table["ABC"] = "1234567890";
> $u = $this->child;
> if (gettype($u) == "object" )
> $u->propag();
> }
>
>
> }//end of class xx
>
>
> // and then ....
>
> $test = new xx(0);
> $test->propag();
>
> $child = $test->child;
>
> $child2 = $child->child;
>
> echo "The value of child is : ".$child2->table["ABC"];
> echo "<br> level: ".$child2->i;
>
> ?>
>
> Whay I cannot see the value of table["ABC"]? At the same time the
> "level" apear ....
>
>
> Thank you,
> Bebe
>
>
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
> For additional commands, e-mail: php-dev-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>
Randy Jonasz
Software Engineer
Click2net Inc.
Web: http://www.click2net.com
Phone: (905) 271-3550
"You cannot possibly pay a philosopher what he's worth,
but try your best" -- Aristotle
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: chris <email protected>: "[PHP-DEV] PHP 4.0 Bug #4338: Header in HTML stream"
- Previous message: daniel.lashua <email protected>: "[PHP-DEV] Bug #4337: Informix ifx_get_blob() causes SIGSEGV in Apache 1.3.9"
- In reply to: Bocskai Stefan: "[PHP-DEV] CLASS Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

