The second approach gives you one additional problem: line length. The Zend coding standard assumes that "the maximum length of any line of PHP code is 120 characters."
This means that if you want to have good (long, descriptive) variable names and you have one for the return value, an object, a good named function, and a long parameter, you are likely to reach the limit of 120 characters.
Add to this, and depending on your standard, the maximum length can be as little as 80 characters or something in between.
Also, I like the first one better if you reuse it
$returnedValue = $object->longMethodName( $argument1, $otherArgument, 42 ); $returnedValue = $object->longMethodName( $argument1, $otherArgument, 42 ); $returnedValue = $object->longMethodName( $argument1, $otherArgument, 42 ); $returnedValue = $object->longMethodName( $argument1, $otherArgument, 42 ); $returnedValue = $object->longMethodName($argument1, $otherArgument, 42); $returnedValue = $object->longMethodName($argument1, $otherArgument, 42); $returnedValue = $object->longMethodName($argument1, $otherArgument, 42); $returnedValue = $object->longMethodName($argument1, $otherArgument, 42);
As Pekka said, fewer eyes jump.
edorian
source share