Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return a formatted string
<?php sprintf(string $format, mixed ...$values): string
<?php $output->startPaging();
}
$output->writeln(sprintf('From <info>%s:%s</info>:', $this->replaceCwd($info['file']), $lineNum));
$output->write(CodeFormatter::formatCode($code, $startLine, $endLine, $lineNum), false);
$output->writeln("\n".$this->e->getMessage());
<?php return $this->macroCall($method, $params);
}
throw new BadMethodCallException(sprintf(
'Method %s::%s does not exist.', static::class, $method
));
}
public function tap($callback)
<?php ->mapWithKeys(function ($value, $key) {
return [$key => static::escapeStringForHtml($value)];
})->map(function ($value, $key) {
return sprintf('%s="%s"', $key, $value);
})->implode(' ');
}
<?php static function httpDate($timestamp)
{
return sprintf('%s GMT', gmdate('D, d M Y H:i:s', $timestamp));
}
static function containsDots($subject)
<?php {
return hash_hmac(
'sha256',
sprintf('%s:%s%s', $socketId, $channelName, $userData ? ':'.json_encode($userData) : ''),
$this->getPrivateToken(),
);
}
<?php }
} catch (AblyException $e) {
throw new BroadcastException(
sprintf('Ably error: %s', $e->getMessage())
);
}
}
<?php });
} catch (ApiErrorException $e) {
throw new BroadcastException(
sprintf('Pusher error: %s.', $e->getMessage())
);
}
}
<?php );
} catch (ConnectionException|RedisException $e) {
throw new BroadcastException(
sprintf('Redis error: %s.', $e->getMessage())
);
}
}
<?php }
throw new UnexpectedValueException(
sprintf("Collection should only include [%s] items, but '%s' found at position %d.", implode(', ', $allowedTypes), $itemType, $index)
);
});
}
<?php $result = call_user_func_array($callback, array_merge($result, [$value, $key]));
if (! is_array($result)) {
throw new UnexpectedValueException(sprintf(
"%s::reduceSpread expects reducer to return an array, but got a '%s' instead.",
class_basename(static::class), gettype($result)
));
}
}
<?php if (! is_string($value)) {
throw new InvalidArgumentException(
sprintf('Configuration value for key [%s] must be a string, %s given.', $key, gettype($value))
);
}
<?php if (! is_int($value)) {
throw new InvalidArgumentException(
sprintf('Configuration value for key [%s] must be an integer, %s given.', $key, gettype($value))
);
}
<?php if (! is_float($value)) {
throw new InvalidArgumentException(
sprintf('Configuration value for key [%s] must be a float, %s given.', $key, gettype($value))
);
}
<?php if (! is_bool($value)) {
throw new InvalidArgumentException(
sprintf('Configuration value for key [%s] must be a boolean, %s given.', $key, gettype($value))
);
}
<?php if (! is_array($value)) {
throw new InvalidArgumentException(
sprintf('Configuration value for key [%s] must be an array, %s given.', $key, gettype($value))
);
}