Guest User

Untitled

a guest
Jun 18th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. function foo($a1 = null, $a2 = null, $a3 = null, $a4 = null){
  2. if ($a1 !== null) doSomethingWith($a1, 1);
  3. if ($a2 !== null) doSomethingWith($a2, 2);
  4. if ($a3 !== null) doSomethingWith($a3, 3);
  5. if ($a4 !== null) doSomethingWith($a4, 4);
  6. }
  7.  
  8. function foo(params $args){
  9. for ($i = 0; $i < count($args); $i++)
  10. doSomethingWith($args[$i], $i + 1);
  11. }
Add Comment
Please, Sign In to add comment