448191 Posted August 13, 2006 Share Posted August 13, 2006 I've got a simple question (Yes, I do those too :P).What was that thing again, whatsjemecallit, you use so you can use both single and double qoutes without having to escape them?Something like EO>>? A link explaining what it is would be nice also. Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/ Share on other sites More sharing options...
448191 Posted August 13, 2006 Author Share Posted August 13, 2006 Wait a second? <<<EOF : "End Of File"?How the *** does that work?I clearly missed something basic here.. :-[ Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-73996 Share on other sites More sharing options...
redarrow Posted August 13, 2006 Share Posted August 13, 2006 example ok[code]echo <<<EOF <div id="main"> {$j_main} </div><!--/main--> </div><!--/outer--> </body></html>EOF;[/code] Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-73999 Share on other sites More sharing options...
448191 Posted August 13, 2006 Author Share Posted August 13, 2006 Nevermind, I found it.[url=http://nl2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc]heredoc syntax[/url] Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-74000 Share on other sites More sharing options...
redarrow Posted August 13, 2006 Share Posted August 13, 2006 does that mean according to that we can use anyold name like<<<hitherehithere; Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-74001 Share on other sites More sharing options...
448191 Posted August 13, 2006 Author Share Posted August 13, 2006 I think it does:[quote=php.net]Another way to delimit strings is by using heredoc syntax ("<<<"). [b]One should provide an identifier[/b] after <<<, then the string, and then the same identifier to close the quotation.The closing identifier must begin in the first column of the line. [b]Also, the identifier used must follow the same naming rules as any other label in PHP: it must contain only alphanumeric characters and underscores, and must start with a non-digit character or underscore. [/b][/quote] Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-74003 Share on other sites More sharing options...
redarrow Posted August 13, 2006 Share Posted August 13, 2006 can you give an example know why use it?what to use it on?so on please cheers. Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-74004 Share on other sites More sharing options...
redarrow Posted August 13, 2006 Share Posted August 13, 2006 it's a short cut not to use the double quotes then?[code]<?php$test=<<<eofmy name is redarroweof;echo $test;?>[/code] Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-74005 Share on other sites More sharing options...
448191 Posted August 13, 2006 Author Share Posted August 13, 2006 Sort of. It behaves identically to double quotes(ie expands variables), but you don't actually use double double quotes, so you can include double quotes in the string without having to escape them.To bad there isn't an equivalent that mimics single quotes, since that's what I'd prefer. (or is there? ::)) Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-74010 Share on other sites More sharing options...
redarrow Posted August 13, 2006 Share Posted August 13, 2006 sorry dont no but thank you for the explenation. Link to comment https://forums.phpfreaks.com/topic/17395-simple-question/#findComment-74017 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.