Tuesday 31 July 2018

syntax - What is the use of



I am implementing node to PDF using drupal and tcpdf. In such case i am suppose to use this << tag. If i didn't give this o/p is not perfect. I can't exactly get the purpose of <<.



Could anybody please explain the concept of this?




$html = <<        
TEST

EOD;


Thanks in advance....


Answer




That is not HTML, but PHP. It is called the HEREDOC string method, and is an alternative to using quotes for writing multiline strings.



The HTML in your example will be:



    
TEST



Read the PHP documentation that explains it.



No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...