php - why not use arrays instead of many parameters -
php - why not use arrays instead of many parameters -
i may sound stupid want know if there benefit of passing arguments function array,rather passing each arguments or downsides?
sure might nicer if pass array method, mean?
arrays signify have collection of same thing, whilst method parameters different things.
if want pass list of things method , same action on of them, makes perfect sense utilize type of array/collection object.
if want create tidier , avoid passing around lots of objects together, consider refactoring code utilize kind of wrapper object can pass around more easily.
also if have many arguments consider using array hold them, it's sure sign need refactor code ;-)
php function
Comments
Post a Comment