News for hackers. Stuff that matters.
Re:Named arguments are coming in PHP 8 by gremlinsinc on Monday July 27, 2020 @09:47AM (#23965027)
it's not the best of both worlds though, splat should only be used on something where you're basically doing the same thing to a bunch of things.

like add(1,2,3,4,5) ->

  function add(...$nums){
    $count = 0;
      foreach($nums as $num) { $count += $num; }
  }
If you know what arguments you're getting, then the more sound way would be just use an associative array, but either way you really don't get great type checking.

This is a much better solution.

There are no comments on this comment yet.