( … ) Variable-length argument lists

In programming, there are many ways to solve a problem. But, everyone likes to easy and short solution.

The reason of telling that, PHP has a syntax token that will make my day. This is called Argument unpacking token or Variable-length argument lists token. This is typed with three dots ( … ). This is safe to use for 5.6 or latest version. For example,

function sum( ...$numbers ) {
    $acc = 0;
    foreach ( $numbers as $n ) {
        $acc += $n;
    }
    return $acc;
}

echo sum( 1, 2, 3, 4 );

return output 10 as 1+2+3+4=10.

Start Gatsby with WordPress

Gatsby is now a day’s roar in the progressive web app. In this post, we will develop a workflow to integrate Gatsby with WordPress.

To integrate WordPress with Gatsby, the first step is set pretty permalink in WordPress. This enables us to use RESTful API from Gatsby app.

Continue reading “Start Gatsby with WordPress”