php, whether you like the language, or abhor it, has always had some of the most useful documentation, I've found.
See Example 5 in https://www.php.net/manual/en/security.database.sql-injectio...
This is the recommended way to avoid SQL injection, using sprintf...
Do you have a method that makes sprintf with d value invalid?
Reading the page I actually think this is pretty good for being language documentation.