GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sergiosgc/php-sprintf: A decorator over sprintf to allow named arguments

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
sergiosgc
sergiosgc
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 

Repository files navigation

php-sprintf

\sergiosgc\sprintf adds to sprintf a new conversion specifier for named arguments. In regular sprintf, arguments are applied to conversion specifiers using order only:

$result = sprintf('%d is %s in %s', $target, $role, $container);

\sergiosgc\sprintf allows you to use named conversion specifiers:

$result = sprintf('%<target> is %<role> in %<container>', [ 'target' => $target, 'role' => $role, 'container' => $container ]);

The first argument after the format string is an associative array of named arguments. You may also use classic position based conversion specifiers:

$result = sprintf('%<named> mixed with %s', [ 'named' => $someVar ], $positionalArgument);

\sergiosgc\printf shares \sergiosgc\sprintf behavior, except it prints the result instead of returning it.

About

A decorator over sprintf to allow named arguments

Resources

Readme
License
Activity

Stars

1 star

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.