• Resolved Parvus

    (@parvus)


    I’m sure the fault is mine, but I cannot get my PHP script to output a line-break. Instead it outputs the text of whatever line-break character string I attempt. For example:

    [insert_php]
    echo ‘line 1’ . ‘\n’ . ‘line 2’;
    echo ‘line 1’ . ‘
    ‘ . ‘line 2’;
    [/insert_php]

    These result in:
    ‘line 1\nline 2’
    ‘line 1
    line 2′

    http://wordpress.org/plugins/insert-php/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Parvus

    (@parvus)

    I knew it was me. Need to use double quotes instead of single for special characters.

    echo ‘line 1’ . “\n” . ‘line 2’ works just fine.

    Smaandar

    (@smaandar)

    If you didn’t want to concatanate strings, you could also just use:

    echo 'line 1. <br /> line 2.';

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to echo a line break?’ is closed to new replies.