Ok, I see where I went too Java in this.

So here's a refinement of what I think PHP should have (optionally):
  • Return types specified. Any syntax, as long as you can. Personally, I'd prefer:
    PHP Code:
    <?php
    string uselessFunction
    ($string){
        return 
    $string//must be a string.
    }
    ?>
    So replace function with whatever the return type is - but still allow function.
    Another way could be:
    PHP Code:
    <?php
    function uselessFunction($stringreturns string{
        return 
    $string;
    }
    ?>
    That's more user friendly but more lengthy - but the 'returns' could be abreviated to _ or something, i.e:
    PHP Code:
    <?php
    function uselessFunction($string_ string{

    }
    ?>
  • More type hinting! Yeah, you can specify a type of object or implementation. I mean full:
    PHP Code:
    function uselessFunction(string $string){ 
    That surely can't cause issues, especially because (a)the manual has the types listed anyway and (b)it would be optional.
  • The ability to use an ordinary variable as it's object. For example:
    PHP Code:
    $str "hello";
    echo 
    $str->replace('h''H'); 
    Again, optional, but I think it would revolutionise PHP's functions - especially because they're so jumbled up as they are.

All of the above wouldn't mess up current code, but it would surely help make code cleaner and more structured.

Agree?