html - PHP expression <<<EOB -
i've been developing php years now, , came across code:
<?php echo <<<eob <html> <head> <title>my title</title> </head> ... eob; ?>
i've never seen approach print html, seems pretty useful , less prone weird variable or double quote syntax error.
i've searched official info , found post of rasmus talking this.
what detailed explanation functionality , eob mean? maybe end of block?
this known heredoc syntax. documentation tell need know.
essentially, however:
a 3rd way delimit strings heredoc syntax: <<<. after operator, identifier provided, newline. string follows, , same identifier 1 time again close quotation.
the closing identifier must begin in first column of line. also, identifier must follow same naming rules other label in php: must contain alphanumeric characters , underscores, , must start non-digit character or underscore.
so eob
author chose delimiter, not sure stands in case identifier can whatever want.
php html heredoc
No comments:
Post a Comment