Too few arguments

Description

Functions such as printf() require at least one argument, the format. In that argument, the function will identify and require more arguments, passed after this first one. When there is not enough arguments for the first one, this error appears.

Not that extra arguments are ignored silently by PHP.

This applies to printf(), sprintf(), fprintf().

Example

<?php

printf('%s %s', 1);

?>

Literal Examples

  • printf(): Too few arguments

Solutions

  • Check that the format (first argument), has only the required placeholders %s, %i

  • Check that the printf() has enough arguments to match the format.

In more recent PHP versions, this error message is now %d arguments are required, %d given.