I remember seeing somewhere using %D or something similar to declare constant where the value of %D is supplied while calling the constant.
define("EVENT_DATE","The event date is %D");
Any information on this, how does it work please?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check out
sprintf()andprintf().Example:
The above will display:
If all you want to do is print, and you’re absolutely sure that the string does not need
htmlspecialchars()applied to it, then you can useprintf()directly. It works just likesprintf(), but it echoes the result instead of returning it.As Mel points out while downvoting,
%Dis indeed astrftime()format. Check that out as well and check Mel’s example of how to use it.