Search code examples
phpvariablesappendvbulletin

How do I append with a line break in PHP?


I'm trying to put a line break before appending my variable so my output is cleaner.

This is what I have:

$vbulletin->templatecache['headinclude'] = fetch_template('drc_base').$vbulletin->templatecache['headinclude'];

which works like:

$foo = $bar.$foo;

or the non existing:

$foo =. $bar

So the template drc_base is some code, and begins/ends with a comment:

<!-- BEGIN TEMPLATE: drc_base -->


...CODE....


<!-- END TEMPLATE: drc_base -->

The way I have appended it, it adds that template to the beginning of the headinclude template, which is some meta tags pretty much.

When I view the source the output looks like this:

<!-- END TEMPLATE: drc_base --><meta http-equiv=.......

So for the sake of neat coding I want the output to be:

 <!-- END TEMPLATE: drc_base -->
 <meta http-equiv=

Is there anyway I can put a line break in this? I have tried:

$vbulletin->templatecache['headinclude'] = fetch_template('drc_base')./n$vbulletin->templatecache['headinclude'];

$vbulletin->templatecache['headinclude'] = fetch_template('drc_base')./n.$vbulletin->templatecache['headinclude'];

and a few other variations with no luck =/


Solution

  • I would suggest using a newline.

    $x."\n".$y
    

    That simple.