* Thus wrote Raffael Wannenmacher:
> hello together
> 
> look at the following code ...
> 
> why is this ..
> 
> -- code start
>        if ( is_object($this->getManagerObject()->getDataFieldManager()) )
>        {
>            for ( $j = 0; $j < 
> $this->getManagerObject()->getDataFieldManager()->getCount(); $j++ )
> ...
>
> -- code end
> 
> .. about 2 seconds slower than this ..
> 
> -- code start
>        $l_objDataFieldManager = 
> $this->getManagerObject()->getDataFieldManager();
> 
>        if ( is_object( $l_objDataFieldManager ) )
>        {
>            for ( $j = 0; $j < $l_objDataFieldManager->getCount(); $j++ )
>            {
>                if ( $l_objDataFieldManager->m_objData[$j]['GI_ID'] == 
> $this->getID() )
>...

This would be expected since each time through the loop, because
the first one has to call a method returning an object of which its
method is called returning another object of another method is then
called upon each time the loop iteration occurs, vs. the latter
where one method is called.

>...
> -- code end
> 
> ???
> 
> i just read, that objects in php 5 automatically returned as reference? 
> in my code it doesn't seems like that!!

The code execution time, in your case, has nothing to do with how
the objects are being returned. You are calling several method()
calls to access one object within a loop, you're second way of
accessing the object is the more sensible way to approach this.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

Reply via email to