Jump to content

heredocs not working


johnmerlino1

Recommended Posts

I have following script:

<?php
    $tireqty = isset($_POST['tireqty']) ? $_POST['tireqty'] : null;
    $oilqty  = isset($_POST['oilqty']) ? $_POST['tireqty'] : null;
        
    echo "<p>order processed on " . date("F d, Y g:sA") . "</p>";
    if($tireqty){
        echo "tire quantity " . $tireqty;
    }
    
    if($oilqty){
        echo "oil quantity " . $oilqty;    
    }
    echo <<<theEnd
    Thank you for visiting
    our store and buying
    $tireqty tires and 3
    $oilqty. Have a very
    nice day.
    theEnd;
?>

Aptana shows error for the last "?>" as soon as I add the heredocs and when running it in browser, I get the following error:

 

Parse error: syntax error, unexpected $end in /home/myuser/public_html/shopwithus.com/controllers/orders_controller.php on line 20

 

What might I be doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/290125-heredocs-not-working/
Share on other sites

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.