PHPnews.io

Overview for 'stitcher-io'

Tests and types

Written by Stitcher.io / Original link on Jun. 6, 2019

Imagine a simple function: rgbToHex.It takes three arguments, integers between 0 and 255; and converts it to a hexadecimal string.Here's what this function's definition might look like in a dynamic, weakly typed language:rgbToHex(red, green, blue) { // …}I think we all agree that "program correc…


Arrow functions in PHP 7.4

Written by Stitcher.io / Original link on May. 1, 2019

Short closures, also called arrow functions, are a way of writing shorter functions in PHP.This notation is useful when passing closures to functions like array_map or array_filter. This is what they look like:// A collection of Post objects$posts = [/* … */];$ids = array_map(fn($post) => $po…