|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-07-07 09:20 UTC] stas at cvs dot php dot net
[2000-07-07 18:48 UTC] stas at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 04:00:01 2025 UTC |
I use here files in string assignments heavily (the majority of my PHP pages are automatically generated by scripts). I use here files specifically as I can't control what characters might be used in those strings (eg quotes, etc). Example: $var1 = <<< END_VAR This is a string END_VAR; The problem enters for some instances of backslashes in the here file: $var2 = <<< END_VAR ... /(o__. _____| \ |OcO| ---------/|-/|-( ,__)-------| | |--------+++++++++/|_| - |_ ----------- /\/ |/ |/ _ \++++++C+O+M+P+L|E+X+I+T+Y+++++O+F+++/f| `-' | |\/ / \/ "++++++D+|+S+T+R+I+B+U+T+E+D+( u| | ___| . .____. /______________| "|++++++S+Y+S+T+E+M+S+\n|_)___(_/----------- _| /| |_ || |_ |____| | "++++++++\| | | | \ /__/LL__,) LL__,) | / (__|__) \ ... END_VAR; This generates the following warning: Warning: Unexpected character in input: '\' (ASCII=92) state=5 in /long/path/here/file.php on line 1552 Most interestingly it doesn't generate a warning for every backslash character. In the above example is misses the first several backslashes and generates a warning on only the strings "\|" and "\<nl>" where <nl> is an LF (bottom of the man's shield and end of his sword). I'm running PHP4 v4.0.1-2.