PHP 5.5 released and other things PHP related
phpweekly.com
phpweekly.com
Highlights:
* Opcode cache (https://wiki.php.net/rfc/optimizerplus)
* Generators and coroutines (https://wiki.php.net/rfc/generators)
* "finally" keyword
* Constant array/string dereferencing
* Optimized access to temporary and compiled VM variables. 8% less memory reads.
* Dropped Windows XP and 2003 support.
I understand compiling bytecode to memory but I still wish there was a way to write files bytecode files back to the disk in a similar fashion to python.
Is there any small (relatively new) PHP framework that isn't based on Symfony2?
[] TechEmpower Benchmark Round 6 was due today, but it was re-scheduled to the 25th [] Symfony should remove High Performance from their homepage title.
I would love to see an asynchronous database client (for instance Mysql) for it, but for now I use PDO.
I don't normally look at most of the articles, but the ones I do read are usually decent!
its also been a while since I've done web dev.
In no small part because novice developers also have a tendency to build queries directly out of $_GET parameters.
While PDO and parameterized queries aren't a silver bullet, simple strings as queries are just a nightmare to do properly.[2]
[1] http://stackoverflow.com/questions/60174/how-to-prevent-sql-... [2] http://www.youtube.com/watch?v=o4dJ7hdA8fs
All you need to do is use a database layer with placeholder values and if you're diligent about encoding everything that way, your chances of being hacked by a simple SQL injection bug are nearly zero. You'll have to make several mistakes before you're in hot water.
`mysql_query` is the worst possible interface to MySQL since it's literally the low-level C bindings ported in to PHP without any kind of enhancement. Those functions were intended for writing more abstract interfaces, not being used directly.
While it is possible to write mysql_query code correctly, it is very challenging and not worth the time when facilities like PDO exist.
Also, if you loathe "over abstracted" database libraries you're probably using the wrong library. A library should make your database interfacing easier, not harder.
>ctrl+f "PSR"
>0 results
Into the trash it goes.
Part of me thinks it's odd, considering I never felt all that much freedom to change how I expressed things in PHP (at least not in the slightest compared to Perl).
Another part of me thinks that enough amateur programmers use PHP that some style guide may benefit them greatly. Then again, if people don't come to a better style through experience (or at least an explanation of the benefits or what mistakes it helps prevent) then is it really as useful?
That's to say PSR-2 is not intended to a be a "best practices" type of thing: it's actually just the result of a survey of member projects at the time with each part chosen because that's what the majority of them did, even if it was just a simple majority or there were member projects were with the majority on, say, tabs vs. spaces but not, say, indentation size. Some of the FIG member projects have adopted it, but several haven't and don't intend to. It's useful if you don't have any other coding standard available, but easily ignored with no loss of interoperability with the other PSRs if you do.
Uncertain why I am getting downvoted for this (top parent) it is my personal opinion and just because you think otherwise isn't a valid reason.
The situation before PSR-0 was a mess of different, incompatible directory layouts for loadable libraries.
PSR-0 is broken on machines using filesystems that aren't completely case-sensitive.
Implementing PSR-0 also takes about five lines of code. Sure, it's more boilerplate, but it's not something that needs to be in core.