user6762450
user6762450

Reputation: 1

Keyword for in heredoc in php

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

Answers (1)

Hanky Panky
Hanky Panky

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

Related Questions