1. PHP Puzzlers #1

    Sat 09 April 2016

    PHP has some idiosyncrasies that can cause odd or counter intuitive behavior. This will be a series of short posts covering some of these situations.

    Let’s have a look at the following simple piece of code:

    $arr = array('foo','bar','baz');
    
    
    foreach($arr as &$item){
       echo "First array: ".$item …
    Tagged as : PHP
  2. Generators In PHP

    Fri 11 March 2016

    PHP 5.5 added a really nice feature: Generators.

    Generators allow you to create a function that returns an list of items without having to create a (possibly very large) array first.

    Here’s a simple “classic” generator example. Suppose you wanted to create a range function (PHP provides this …

    Tagged as : PHP

Page 1 / 1