![]() So the only time this allows someone to find out you're using PHP (and 'roughly what version') is if it's already in a header in the response. This is not impossible to disable as it seems to describe it, but instead it's as simple as turning off expose_php in php.ini. I'd agree this is a totally ridiculous addition to the interpreter, but this is wrong. Not only is this completely irrelevant to building your application, but it allows detecting whether you’re using PHP (and perhaps roughly guessing what version), regardless of how much mod_rewrite, FastCGI, reverse proxying, or Server: configuration you’re doing. PHP is full of strange “easter eggs” like producing the PHP logo with the right query argument. I kept thinking I should be compiling a list as I went through, but sadly only decided to start near the end. (Can't explode a string to get individual characters? Have to use str_split? No. That said, some of the stuff is wrong, some of it is just whining ("Oh, woe is me, the array access does not support slices! Just like in most other languages!"), and some of it just seems that, despite his clearly extensive knowledge, he missed out on some basics. Some that were surprising or unknown even to me. I certainly can't argue that this guy makes a lot of valid points. It saves so little and introduces something that, by its nature, is confusing to people even after they've used it for a while. You can unquote it (which would generate a warning anywhere else!), or use $ to parse it inside a double quotes string. You can’t quote keys in variable interpolation, i.e., "$foo" is a syntax error. This is part of the PERL regex library and stolen from PERL. Preg_replace with the /e (eval) flag will do a string replace of the matches into the replacement string, then eval it. This is the same way in Java & C++, use protected if you want subclasses to see your shit, test mocks can use RelfectionClass & ReflectionMethod to access and call private methods, but it's kind of ugly. Subclass overrides of public methods can’t even see, let alone call, the superclass’s private methods. Subclasses cannot override private methods. This isn't particularly uncommon in web programming, but it's still a fair, since usually it's because the app designers explicitly caught and logged exceptions, PHP files exceptions and error codes away by default. Most error handling is in the form of printing a line to a server log nobody reads and carrying on. See:, but yeah bad defaults, still bad design, but relatively easy to work around. This is the default, if you turn on errors as exceptions, you get good stack traces. ![]() PHP errors and PHP exceptions are completely different beasts. This plus PHP short tags make a decent (if somewhat verbose) built-in template language, this is a questionable thing to have, except PHP (originally) stood for "Hypertext Processor" (except in Portuguese) (I think… Maybe that's a backronym) Those are there for embedded templates like: There’s redundant syntax for blocks: if (.). ![]() Oh who am I kidding I abuse the fuck out of the slice operator and generators when I'm coding python. If I have a nice consistent slice function (that can be extended by user defined types) (which PHP doesn't have) and a nice consistent Interator interface that I can hack together with lambda functions. Plenty of modern languages don't have these, these are more "nice to haves". These sound like "wah" PHP isn't Python or Ruby. cannot slice it only retrieves individual elements. (object) can be used to go the other way. This is used to convert between objects defined with stdClass() and an associative array. Given that PHP has no other structure type, I don’t know why this exists. There’s an (array) operator for casting to array. Just a few key defences of some of the features. Ok overall, this is a very good laundry list.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |