Jump to content
Killersites Forums

Here Document


nrvncanada
 Share

Recommended Posts

Hi, can anyone please give me complete working code for here document in PHP? Please do not give extracts of the example like

 

<?php

echo <<

 

Hi, I want an example of php here document.

Not the extracts of php code, rather complete code.

I mean starting with and ending with .

Please put code only if you were able to interpret/ compile the code succussfully.

 

END;

 

?>

 

If you could provide the solution, I am thankful to you. Otherwise too thankful.... Just kidding

Link to comment
Share on other sites

<?php

$name = "Joe Smith";

$occupation = "Programmer";

echo <<

 

This is a heredoc section.

For more information talk to $name, your local $occupation.

 

Thanks!

 

EOF;

 

$toprint = <<

 

Hey $name! You can actually assign the heredoc section to a variable!

 

EOF;

echo strtolower($toprint);

 

 

?>

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...