On Thu, Feb 28, 2008 at 4:22 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
> So, I guess my question would be, why not take it one level deeper.
>
> <?php
> include('ArrayClass.php');
>
> function sillyFunc() {
> return ArrayClass::create(array('a' => 1, 'b' => 2, 'c' => 3, 'd' =>
> 4));
> }
>
> echo sillyFunc()->a . PHP_EOL;
> ?>
the idea is that you get something that can be used repeatedly. in your
example you are creating the array that is supplied to the
ArrayClass::create() method, whereas in mine it is supplied by something
else. of course you could create a global function that wraps the
ArrayClass::create() method, and in that case it might make sense to leave
the constructor public and just wrap the instantiation of the ArrayClass
class. but thats why i created the static method in the first place, that
and the issue we observed a while back about not being able to invoke a
method on an object in the same statement that instantiates it.
-nathan