Search code examples
phpquotesstrftime

Pass a variable within single quotes


Could someone please educate me a little on this? I can't figure out how to pass a variable into functions like strftime.

For example:

$day = '%a';
echo strftime('$day', time());

I can't figure out how to make the variable not be passed as a literal. Thanks for the help!


Solution

  • For this example, you don't need quotes at all:

    echo strftime($day, time());