dream25 Posted January 22, 2007 Share Posted January 22, 2007 what is the use of heredoc... i think it is traditional string creation tool... i tried in ie7 but its not working... tell me the soultions to work in it.. Link to comment https://forums.phpfreaks.com/topic/35206-use-of-heredoc/ Share on other sites More sharing options...
dream25 Posted January 22, 2007 Author Share Posted January 22, 2007 this is the format to declare the heredoc ....$my_string = <<<TESTTizag.comWebmaster TutorialsUnlock your potential!TEST; Link to comment https://forums.phpfreaks.com/topic/35206-use-of-heredoc/#findComment-166237 Share on other sites More sharing options...
Cep Posted January 22, 2007 Share Posted January 22, 2007 1. You haven't explained what heredoc is so please dont expect anyone else to know2. What did you try in IE7? what is the bug/error/problem?3. If you want answers or help, help us to help you by providing enough information about the problem.Plus the string you just placed up is incorrect as it is not surrounded in " quote marks. As,[code=php:0]$my_string = "<<<TEST Tizag.com Webmaster Tutorials Unlock your potential! TEST";[/code] Link to comment https://forums.phpfreaks.com/topic/35206-use-of-heredoc/#findComment-166241 Share on other sites More sharing options...
dream25 Posted January 22, 2007 Author Share Posted January 22, 2007 This the html code....<html><head><title>My First PHP Page</title></head><body><?php$my_string = "<<<TEST Tizag.com Webmaster Tutorials Unlock your potential! TEST";echo $my_string;?></body></html>if i run this one.. the result has displayed like this << Link to comment https://forums.phpfreaks.com/topic/35206-use-of-heredoc/#findComment-166245 Share on other sites More sharing options...
Cep Posted January 22, 2007 Share Posted January 22, 2007 The reason for this is because HTML markup uses opening < and closing > brackets.You could do one of two things add another < to your string OR you could escape each of them using "\<\<\< Link to comment https://forums.phpfreaks.com/topic/35206-use-of-heredoc/#findComment-166246 Share on other sites More sharing options...
trq Posted January 22, 2007 Share Posted January 22, 2007 [quote]You haven't explained what heredoc is so please dont expect anyone else to know[/quote]It is part of standard php. Read the manual on [url=http://php.net/echo]echo[/url] for more infomation.[code]<html><head><title>My First PHP Page</title></head><body><?php$my_string = <<<TESTTizag.comWebmaster TutorialsUnlock your potential!TEST;echo $my_string;?></body></html>[/code]Should work. make sure the closing TEST is not indented. Link to comment https://forums.phpfreaks.com/topic/35206-use-of-heredoc/#findComment-166250 Share on other sites More sharing options...
Orio Posted January 22, 2007 Share Posted January 22, 2007 About [url=http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc]heredoc[/url], from the manual.Orio. Link to comment https://forums.phpfreaks.com/topic/35206-use-of-heredoc/#findComment-166382 Share on other sites More sharing options...
Psycho Posted January 22, 2007 Share Posted January 22, 2007 [quote author=Cep link=topic=123485.msg510410#msg510410 date=1169466403]Plus the string you just placed up is incorrect as it is not surrounded in " quote marks. As,[code=php:0]$my_string = "<<<TEST Tizag.com Webmaster Tutorials Unlock your potential! TEST";[/code][/quote][quote author=Cep link=topic=123485.msg510415#msg510415 date=1169467176]The reason for this is because HTML markup uses opening < and closing > brackets.You could do one of two things add another < to your string OR you could escape each of them using "\<\<\<[/quote]Do not respond on that which you know not. When using the heredoc syntax you DO NOT enclose the content within quotes. Everything you posted above was completely false. Link to comment https://forums.phpfreaks.com/topic/35206-use-of-heredoc/#findComment-166487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.