ID:               21956
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: Win2k
 PHP Version:      4.3.0
 New Comment:

There's nothing wrong/broken in it:

<?php

define('foo', <<<THISISSTRING
the string goes here
THISISSTRING
);

echo foo;

?>

outputs 'the string goes here' so it works fine.

You're just doing something wrong, most likely you
have some empty space before the heredoc end tag..
Not bug.



Previous Comments:
------------------------------------------------------------------------

[2003-02-07 09:38:03] [EMAIL PROTECTED]

if this is not a bug, then it would therefore be the same across all
platforms?  which would then I surmise be a documentation problem.

Since http://www.php.net/manual/en/language.constants.php defines
thus:

"Syntax
You can define a constant by using the define()-function. Once a
constant is defined, it can never be changed or undefined. 

Only scalar data (boolean, integer, float and string) can be contained
in constants."

which then links to the string defintion page here,
http://www.php.net/manual/en/language.types.string.php, where the
Syntax for string is outlines as below.

"Syntax
A string literal can be specified in three different ways. 

single quoted 
double quoted 
heredoc syntax 
"

so according to the documentation, define can take heredoc syntax as a
valid string, since heredoc is defined as a valid string syntax.

if this is incorrect, then please change this to a documentation issue
by all means, but this is not a bugus bug, it happens.

------------------------------------------------------------------------

[2003-02-07 07:26:48] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Please read http://www.php.net/manual/en/function.define.php it has
good nice examples on it.

------------------------------------------------------------------------

[2003-01-29 19:52:03] [EMAIL PROTECTED]

when using define() to create constants, it all seems to work fine when
using standard strings.

However, under the definition for the arguments on define(), it says
that the define function can take string() as an argument.

looking at strings, heredoc is a valid string argument, however when
trying to define a constant as follows, the constant returns a null
string.

define($html_header, <<<THISISSTRING
the string goes here
THISISSTRING
);

if however you define a standard var like so:

$str_header=<<<THISISSTRING
the string goes here
THISISSTRING
;

then do:

define($html_header $str_header);

all works fine.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21956&edit=1

Reply via email to