Jump to content

break line without breaking the assignment


miriamn

Recommended Posts

Hi,

 

 

 

I know Perl , starting to work with PHP.

 

 

 

I want to put a very long string into a variable, I don’t want to write the string in a very long line. (for readability…)

 

I want to “break” the line without breaking the assignment to the variable.

 

 

 

In Perl, I’m doing something like:

 

 

 

$var =<< HTML;

 

  here is the text….

 

  here is the text….

 

  here is the text….

 

  here is the text….

 

HTML

 

 

 

( instead of : $var =”  here is the text….  here is the text…. here is the text….here is the text…. “; )

 

 

 

Is there something similar in PHP?

 

 

 

Thanks,

 

Miriam.

 

 

You can do pretty much the same as you do in Perl in PHP. It's called Heredoc syntax.

 

And, surprise, surprise, it is actually in the manual...

 

http://nl3.php.net/manual/en/language.types.string.php

 

Btw, moving to PHP Help, this has nothing to with Application Design...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.