News for hackers. Stuff that matters.
Re:What PHP 5.5 might look like by frosas on Thursday July 12, 2012 @10:37AM (#4234697)
I agree keyword arguments are a better solution (but probably harder to implement).

Right now this is how I do this:

    function salute($user, array $options = null) {
        $options = (array) $options + array('shout' => false);
        $salutation = "Hi $user!";
        if ($options['shout']) $salutation = strtoupper($salutation);
        return $salutation;
    }
Re:What PHP 5.5 might look like by smsm42 on Thursday July 12, 2012 @09:44PM (#4237810)
It is significantly harder to implement, especially if you think about what happens with existing functions, especially internal ones.