Reputation: 1
there is way to put for loop in heredoc in php ? Because when I but it in heredoc it showed as I write it without execution. Thanks for all.
Upvotes: 0
Views: 69
Reputation: 46900
No, there is no way. heredoc is only a way to delimit strings and nothing more than that. Any other language struct given in a string will not execute. See http://www.php.net/eval if you're hard bent on it
A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.
Upvotes: 1