Skip to content

Instantly share code, notes, and snippets.

@onyxraven
Last active November 13, 2019 11:48
Show Gist options
  • Save onyxraven/1902197 to your computer and use it in GitHub Desktop.
Save onyxraven/1902197 to your computer and use it in GitHub Desktop.
Named param vsprintf()
<?php
function nvsprintf($str, $args) {
$i = 1;
foreach ($args as $k => $v) {
$str = str_replace("%{$k}$", "%{$i}$", $str);
$i++;
}
return vsprintf($str, array_values($args));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment