jalet / util-sprintf
PHP's sprintf for named params with type casting.
This package's canonical repository appears to be gone and the package has been frozen as a result.
dev-master
2013-04-24 09:37 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2020-01-24 15:14:41 UTC
README
PHP's sprintf for named params with type casting.
use Jalet\Util\Sprintf; echo Sprintf::f("I am %age:int% years old.", array('age' => '25y')); // I am 25 years old. echo Sprintf::f("Oh my god, it's %val:bool:str%.", array('val' => 1)); // Oh my god, it's true. echo Sprintf::f("My cat is %color%.", array('color' => 'brown')); // My cat is brown. echo Sprintf::f("INSERT INTO table (username, active) VALUES ('john.doe', %active:bool%);", array('active' => false)); // INSERT INTO table (username, active) VALUES ('john.doe', 0);