Performance tests: Default arguments

at 2006-08-15 in Experiments by friebe (0 comments)

Assume we have the following function:

<?php 
function fixture($r1, $r2, $o1= array(1, 2), $o2= NULL, $o3= 'foo') {
// ...
}
?>

What's faster? Calling it via fixture(1, 2) or supplying all the default arguments (fixture(1, 2, array(1, 2), NULL, 'foo');). The answer is: It's equivalent.

See this experiment for details.



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases

Related

Find related articles by a search for «Performance».