I am a new php user. php sems awesome on some dimensions, and frustrating on others. at least since BASIC, all my languages except php have allowed me to predeclare my variables. Is there a hack to allow non-functional declarations (so my own code analyzer can then look for potential uses of variables that have not been declared)? I am even contemplating putting them in comments so I can check. (I do know that I can force runtime errors on undeclared variables.)
I have been bitten many times by slight misspellings in php. right now, even if declarations were wholly non-functional, for my own program-reading sake, I would love to declare "int $x;" or better yet "int $x=0;" . I am looking at php7, and php7 seems to allow declaration in function arguments, but I see no mention of declaration in the program code itself. is there a rationale to this?
General discussion on PHP
1 post • Page 1 of 1