PHP strips newlines by default

  1. -
    test-
  2. -
    test 
    -
  3. -
    test-
  4. -
    test
    -
  5. -
    test
    -
  6. -
    test
    -
  7. -
    test
    test
    -

Source

  1. <pre><span>- <?php echo '<span class="test">test</span>'; ?> -</span></pre>
  2. <pre><span>- <?php echo '<span class="test">test</span>'; ?> -</span></pre>
  3. <pre><span>- <?php echo '<span class="test">' . 'test' . '</span>'; ?> -</span></pre>
  4. <pre><span>- <?php echo '<span class="test">test</span>' . "\n"; ?> -</span></pre>
  5. <pre><span>- <?php echo '<span class="test">test</span>' . "\r\n"; ?> -</span></pre>
  6. <pre><span>- <?php echo '<span class="test">test</span> '; ?> -</span></pre>
  7. <pre><span>- <?php for ($i = 0; $i < 2; $i++) { ?> <span class="test">test</span> <?php } ?> -</span></pre>