Example 1 — Print From an Array
Fill the placeholders with an array of values.
<?php
$data = ["Cart", 3];
vprintf("%s has %d items" . PHP_EOL, $data); How It Works
- Prepare the values. An array holds the text and the number.
- Write the format.
%stakes text and%dtakes an integer. - Print. vprintf() fills the placeholders in order.
- New line.
PHP_EOLends the line.

