

Generators come to PHP - arbuge
http://www.lornajane.net/posts/2013/simplest-php-generator-example?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+lornajane%2Fphp+%28LornaJane+PHP%29

======
adlpz
I expect some hate towards PHP here, so I want to say something.

I've been working on some big PHP applications lately and I can say that the
language is very much moving away from its past bad reputation.

PHP 5.4 is a quite modern language, with a pretty decent object-oriented
structure, namespacing, lambdas, closures and most of the usual goodies.

It is true that you _can_ still write terrible PHP even with the last version,
but you don't _have_ to. PHP has now most of the tools necessary so you can
use it on pair with languages like Python or Ruby, and the new generators on
5.5 brings it even further.

~~~
yareally
> It is true that you can still write terrible PHP even with the last version,
> but you don't have to.

One can write terrible code in any language though :). A language is only as
good as the person using it, just as a canvas & brush is only as good as the
artist. While some might complain it doesn't look as typographically pleasing
as some other languages, as long it does not resemble COBOL or Visual Basic, I
do not consider it hideous by any means.

I have no quarrel though with PHP since 5.3 really other than they need to
write an Object Oriented front end for PostgreSQL for their API like they have
for MySQLi. Using PostgreSQL in PHP with something like PDO doesn't work when
you want to do asynchronous queries (which MySQLi and PostgreSQL support). I
ended up writing a wrapper class sometime ago around the PostgreSQL PHP API
just to deal with that issue, but official API support would be better.

I don't use PHP quite as much as Python for web stuff as I once did, but it
would be my alternative goto (no pun intended[1]) language for web stuff.

[1] <http://php.net/manual/en/control-structures.goto.php>

