Is there a way to 'prepare' a string for later interpolation (without using custom expansion function)?
For instance:
class Test {
private static $STR_VAL = "the val is $v";
public static function printVal($v) {
echo self::$STR_VAL;
}
}
sprintf()
class Test {
private static $STR_VAL = "the val is %s";
public static function printVal($v) {
echo sprintf(self::$STR_VAL, $v);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With