The arguments array must contain %d items, %d given

Description

When using vsprintf(), the second argument is an array which must hold the same number of elements than there are placeholders in the format string (aka, the first argument).

Example

<?php

    var_dump(vsprintf("%04d-%02d-%02d", []));

?>

Literal Examples

  • The arguments array must contain 3 items, 0 given

Solutions

  • Add the needed elements to the array.

  • Remove the superfluous placeholders in the format string.