note 9523 added to Strings

From: Date: Thu, 09 Nov 2000 00:27:08 +0000
Subject: note 9523 added to Strings
Groups: php.notes 
Request: Send a blank email to php-notes+get-7511@lists.php.net to get a copy of this message
Here doc in PHP4 has one very interesting gotcha. If you save files in Windows format, to be displayed via a UNIX system, you'll get a parse error every time you try to use a here doc statement as in print <<<EOT EOT; etc. This is because the Windows file will contain \r\n by default, but the PHP parser in UNIX is looking for only \n at the end of the <<<EOT part. Because these characters are invisible in most editors, you won't know that this mixup is happening. Solution: use an editor that allows you to save a file in UNIX newline format, or write a regex to do it manually. This took me a while to figure out. Should save someone else from graying prematurely. http://www.php.net/manual/language.types.string.php

« previous php.notes (#7511) next »