Re: Threading objects
| From: | W. Enserink | Date: | Wed, 12 Mar 2003 11:29:47 +0000 |
| Subject: | Re: Threading objects | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139260@lists.php.net to get a copy of this message | ||
i'm not sure what you want. But you have created objects here in $a,$b and
$c.
If you want to order them in a special way you have to write the
functionality of course. I think you have to do this before the object is
created because you define the variables 10,5,1 before the objects are
created. Once the objects are created they themselves don't know nothing
form each other. So th eparent object has to control this, or in your case a
'parent piece of script'.
You can use $a,$b,and $c as regular,ordinary variables. further on.
hope it helped,
Wilbert
----- Original Message -----
From: "Kris" <kreid2@bigpond.net.au>
To: "PHP List" <php-general@lists.php.net>
Sent: Wednesday, March 12, 2003 12:18 PM
Subject: [PHP] Threading objects
> I want to be able to thread objects. I'm not really sure at all where to
> start. but I want a script where multiple objects are being processed at
the
> same time.
> I have an example php script
>
> <?
>
> $a = new sleeper();
> $b = new sleeper();
> $c = new sleeper();
>
> $a->sleepFor(10);
> $b->sleepFor(5);
> $c->sleepFor(1);
>
> class sleeper {
>
> function sleepFor($num) {
> sleep($num);
> echo "sorry I was a sleep for $num \r\n";
> }
>
> }
>
> ?>
>
> I want so object $c would print then object $b then object $a as the
> sleeping time is less and less.
> Does that make sense? Please ask if you don't understand
>
> Thanks for any help you can offer what so ever.
>
> Kris
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
info@pdd.nl
-------------------------