I asked such a question before, but it's different, it's more about the parsing logic.
My previous questions were about how to embed a function inside a string (with double quote), and I got this answer:
$date = "date";
echo "This page is under construction<br/><br/>Current Date: {$date('l jS \of F Y')}";
And after that, I started wondering why the one below does not work, while the one above works fine:
echo "This page is under construction<br/><br/>Current Date: {date('l jS \of F Y')}";
Like the logic of the analysis process, even if the variables work pretty well inside the strings.
I read that after the PHP parser sign, $he tries to find the appropriate variable for parsing and running, as well as to delimit the variable name, we also use curly braces {}, and this is also what I understand fairly.
But why does this syntax seem necessary when developing a parser engine for functions, because at first it made no sense to me.
Basically, why do I need to define a variable that contains a string representation of the function name, for example, below:
$date = "date";
Thanks in advance.
source
share