0

I am trying to write the below code in Nowdoc syntax but directly under the $str = <<<HTML

I have an error on the first line. I have no idea why. I'm using this in another project and its fine.

$str = <<<HTML
    <div>
        <div class="product-thumb">
            <div class="ribbon">
                <img src="/img/affiliate.png"  alt=""/> 
            </div>

            <a href="">
                <header class="product-header">
                    img  
                </header>
                <div class="product-inner">
                    <h5 class="product-title">client name</h5>
                    <div class="product-meta">
                        <ul class="product-price-list">
                            <li><span class="product-save">saving</span></li>
                        </ul>
                    </div>
                    <p class="product-location"><i class="fa fa-map-marker"></i> cat</p>
                </div>
            </a>
        </div>
    </div>
HTML;

I get the following error

Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in

Bruce
  • 1,647
  • 4
  • 20
  • 22
Daniel Robinson
  • 643
  • 1
  • 10
  • 25

1 Answers1

2

End of file means the script has either a ?> before that part, the script is dying or you have same hidden char before $str. Try deleting contents before $str (even if you don't see a char).

Bruce
  • 1,647
  • 4
  • 20
  • 22
Marco
  • 2,757
  • 1
  • 19
  • 24