It's about code readability:
I've been dealing with this for a long time and I always wonder what would be the best approach to deal with passing parameters.
Lots of times, reading code from other programmers I find lines as such:
$Instance->functionCall('Abc123', 5, 1.24, 'XYZ', 642);
This makes me have to go to the Class file and take a look at what those parameters mean.
I do my best to write readable code by doing this:
$user_name = 'Abc123';
$age = 5;
$height = 1.24;
$hobbies = 'XYZ';
$num_brothers = 642;
$Instance->functionCall($user_name, $age, $height, $hobbies, $num_brothers);
Or this:
$Instance->functionCall($user_name = 'Abc123', $age = 5, $height = 1.24, $hobbies = 'XYZ', $num_brothers = 642);
But this variables occupies memory, not being used anywhere else. I like to think that this 'lost' memory space is worth it by being more readable, but I'd like to know if there is a better way.
Any ideas?
Thanks all!