Why is there an error in this PHP code ? WAMP SERVER 3 , Netbeans 8.0
            Asked
            
        
        
            Active
            
        
            Viewed 109 times
        
    -3
            
            
         
    
    
        Ameen Zami
        
- 61
- 1
- 1
- 4
- 
                    i though this was some spooky incantation or something – Kevin Jul 26 '16 at 05:18
- 
                    Are there any whitespace characters after <<– Bizley Jul 26 '16 at 05:25 
- 
                    Why keep the supposed error tooltip a secret? – mario Jul 26 '16 at 05:26
2 Answers
0
            The first line of heredoc string must have NO indentation... like this:
    function __construct()
      { 
       $a = some_code();
       $b = some_more_code();
       $x = <<<EOT
line1
line2
line3
line4
EOT;    
        $c = even_more_code();
        $b = still_more_code();
        ...
        ...
        ...
see more here: HEREDOC interfering with code indentation
 
    
    
        Community
        
- 1
- 1
 
    
    
        Jethro Hazelhurst
        
- 3,230
- 7
- 38
- 80
0
            
            
        It looks you have tabs in your code. Check this code below, its working fine for me,
$x = <<<EOT
   line1
   line1
   line1
EOT;
echo $x;
Do not include any spaces or tabs at the end of string i.e. EOT(2nd last line).
 
    
    
        pravindot17
        
- 1,199
- 1
- 15
- 32
- 
                    
- 
                    glad to know that worked for you, can you please mark it as the answer , thank you :) – pravindot17 Jul 26 '16 at 08:48
- 
                    
- 
                    just click on the right arrow on left side of my answer, thank you :) – pravindot17 Jul 28 '16 at 05:22
