The answer, as everyone says, is "it depends." In your specific example, the βcreateβ function, the code is less obvious for operation and maintenance, and therefore it is probably a good idea to avoid this pattern.
But here is the good news, there is a way to do what you are trying to do, which makes things simple and compact without using links:
function create_pets(){ return array(get_dogs(), get_cats()); } function foo(){ list($dogs, $cats) = create_pets();
As you can see, you can simply return the array and use the list language construct to get the individual variables on the same line. Itβs also easier to say what happens here, create_pets () will obviously return the new $ cats and $ dogs; the previous method using links did not make this clear if only one verified create_pets () was not directly.
You will not find a difference in performance when using either method, although both will work. But you will find that the recording code, which is easy to track and operate, ultimately goes a long way.
source share