[PHP4BETA] Arrays inside classes (repost)

From: Date: Wed, 09 Feb 2000 15:59:40 +0000
Subject: [PHP4BETA] Arrays inside classes (repost)
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-9985@lists.php.net to get a copy of this message
Hello! Any info on this? Faisal. ----- Original Message ----- From: "Faisal Nasim" <faisal@nasim.org> To: <php4beta@lists.php.net> Sent: Wednesday, February 09, 2000 1:24 PM Subject: [PHP4BETA] Arrays inside classes : Hi, : : Can anybody tell me how to make the copy of array when accessing : through classes' functions? : : TEST CASE: : : <? : class myclass : { : var $MYARRAY; : : function myclass () : { : $this->MYARRAY[] = "faisal"; : $this->MYARRAY[] = "nasim"; : } : : function test () : { : $x = $this -> MYARRAY; # I want a copy! : unset ( $x[0] ); : } : } : : $test = new myclass; : : print count ( $test -> MYARRAY ) . "<BR>"; # 2 : $test -> test (); : print count ( $test -> MYARRAY ) . "<BR>"; # 1 !! : ?> : : : : I would like to make a copy of $MYARRAY in test().... I am not : using & to point to the same address, so by default it should : create a copy and not a reference! : : Any thoughts? : : Thank you. : : Faisal Nasim : faisal@nasim.org

« previous php.version4 (#9985) next »