On Mon, 6 Oct 2003 13:41:22 -0400, you wrote:

>1) How can I create an array of classes so they could be referenced, for
>instance: $array[$uniqueID][$class->var] = 10; ?
>
>2) Would it instantiate when that particular element was used and would the
>constructor run at that point?
>
>3) Any way to dispose/destroy of an object once it's done being used to free
>up the resources?

<?

class A {
        function A () {
                echo ("<p>Created</p>");
        }

        function B ($s = "None") {
                echo ("<p>input : $s</p>");
        }
}

$C = array();

for ($i = 0; $i < 3; $i++)
{
        $C[$i] = new A();
}

for ($i = 0; $i < 3; $i++)
{
        $C[$i]->B($i);
}

for ($i = 0; $i < 3; $i++)
{
        unset ($C[$i]);
}

?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to