LMSouq
php-dev Open

PHP sprintf escaping %

SA
Sandeepan Nath
1 month ago
3 views
Problem Description
I want the following output:- > About to deduct 50% of € 27.59 from your Top-Up account. when I do something like this:- $variablesArray[0] = '€'; $variablesArray[1] = 27.59; $stringWithVariables = 'About to deduct 50% of %s %s from your Top-Up account.'; echo vsprintf($stringWithVariables, $variablesArray); But it gives me this error `vsprintf() [function.vsprintf]: Too few arguments in ...` because it considers the `%` in `50%` also for replacement. How do I escape it?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base