PHP strategy -- pass complex parameters by value or by reference?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a function to process a data file.  This process opens the file, and then calls
another function to process each entry.  This function in turn calls another function to
process each line of the entry.  A set of fairly complex arrays specifies how all the
possible types of entries and lines should be processed, and each function passes sections
of these arrays to the next function.

Is it better to pass the parameters by value, in which case they have to be copied into
yet more memory when the function is called, or to pass by reference, which I suspect may
involve additional overhead every time they are accessed?

And is it better to combine several specifications arrays into one more complex array, and
pass a single parameter, or to pass them individually as half a dozen different
parameters?

I suspect that I am probably asking a "how long is a piece of string?" type of question,
but are there any general rules which are applicable to this type of situation?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux