Become a Patron!

My Amazon wishlist can be found here.

Life Line

Typehints and = null

I just committed a patch to PHP CVS which allows you to do the following:

<?php
class foo {
    }
    function bla( foo $blah = null )
    {
        var_dump( $blah );
    }
    $f = new foo;
    bla( $f );
    bla();
    bla( null );
?>




Shortlink

This article has a short URL available: https://drck.me/ta-n-47q

Comments

THANK YOU! Will it be in 5.1 ?

Yes, it will be in PHP 5.1.0.

I was hoping this would be added.

Thank you for making my life a little bit easier. Now I can be even LAZIER with doc comments :D

I'm going to assume that this will be in 6.0 as 5.1 has Release Candidates out.

That is what he just said. :)

No, I said that this will be in PHP 5.1.0 too.

Add Comment

Name:
Email:

Will not be posted. Please leave empty instead of filling in garbage though!
Comment:

Please follow the reStructured Text format. Do not use the comment form to report issues in software, use the relevant issue tracker. I will not answer them here.


All comments are moderated