Escape percent sign in PHP sprintf
Why would anybody need to know that? For me it's using it in a sql query in combination with a like request.
The simple solution: Use two of them.
$likeQuery = sprintf('
SELECT *
FROM `user` u
WHERE u.roles LIKE "%%%s%%"
', User::ROLE_ADMIN);
Which will result in:
'SELECT * FROM `user` u WHERE u.roles LIKE "%ROLE_ADMIN%"'