Follow

The number one take-away I have from Golang when writing PHP is: sprintf() is amazing, and we should use it way more. I wish that PSR-3 had supported it out of the box.

@dshafik Thing is, prior to unpacking, you couldn't reasonably use it in a passthrough method without invoking the evil that is call_user_func_array().

function logPrintf($msg) {
return log(call_user_func_array('sprintf', func_get_args()));
}

vs

function logPrintf($msg, ...$args) {
return log(sprintf($msg, ...$args));
}

Sign in to participate in the conversation
Mastodon for Tech Folks

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!