Declaring Variable Types in PHP?
问题 I was trying to get my Netbeans to autocomplete with PHP, and I learned that this code is valid in PHP: function blah(Bur $bur) {} A couple of questions: Does this actually impose any limits on what type of variable I can pass to the blah method? If this is just to help the IDE, that's fine with me. How can I declare the type of a variable in PHP if I'm not in a function? 回答1: This type-hinting only works for validating function arguments; you can't declare that a PHP variable must always be