Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Lorna Mitchell: Simplest PHP Generator Example

Lorna Mitchell: Simplest PHP Generator Example

On her blog Lorna Mitchell has posted an example of a basic generator written in PHP, a feature of the upcoming PHP version 5.5.

I really like the generators feature that’s arriving in PHP 5.5, and since we’re now into release candidate releases, it’s actually not that far away. I’ve been speaking on this topic and I thought I’d share my trivially simple code example from my slides.

She includes an example of a very basic generator using the new “yield” keyword and how to implement it in a simple foreach loop. There’s also a little talk about when is a good time to use generators in your applications (two examples: complex number calculation and working with large data sets a chunk at a time). For more information on how these generators will work, check out this page in the PHP manual.

Link: http://www.lornajane.net/posts/2013/simplest-php-generator-example
Source: http://www.phpdeveloper.org/news/19623

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Posted Maj 23rd, 2013 in WEB and PHP Development.

Leave a response: