SV: [PHP-DEV] Bug #3623: PHP fails to interpret included or required array declaration and init.
| From: | Johan Ekenberg | Date: | Sat, 26 Feb 2000 00:36:25 +0000 |
| Subject: | SV: [PHP-DEV] Bug #3623: PHP fails to interpret included or required array declaration and init. | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11016@lists.php.net to get a copy of this message | ||
> Sorry, that was a typographical error I made when typing my code into
> your bug reporting web window. The actual code DOES have an array()
> operator.
From what I can see, the issue is not about array(), but about
<? ?>, which are required around PHP code also in included files.
Included files are always interpreted in HTML-mode. This is
easy to forget, since you call them from PHP-mode.
/Johan Ekenberg
> > -----Original Message-----
> > From: lbb@ocare.com [mailto:lbb@ocare.com]On Behalf Of Flavien LEBARBE
> > Sent: Friday, February 25, 2000 12:26 PM
> > To: chris@claimlynx.com
> > Cc: php-dev@lists.php.net
> > Subject: Re: [PHP-DEV] Bug #3623: PHP fails to interpret included or
> > required array declaration and init.
> >
> >
> > This is _NOT_ a bug ! :-)
> >
> >
> > You need to have the code in included files surrounded by
> > tags too :
> >
> > <?php
> > $myarray=array( // <== NOTICE 'array'
> > "a" => "apple",
> > "b" => "banana",
> > "c" => "cherry"
> > );
> > ?>
> >
> > Flavien Lebarbé
> > --
> > Open Care.
> >
> > chris@claimlynx.com wrote:
> > >
> > > From: chris@claimlynx.com
> > > Operating system: FreeBSD3.3
> > > PHP version: 3.0.12
> > > PHP Bug Type: Parser error
> > > Bug description: PHP fails to interpret included or
> > required array declaration and init.
> > >
> > > Using Apache 1.3.9 module version of PHP.
> > >
> > > In an HTML web page, the following simply displays the
> > actual text of the PHP code instead of it being interpreted.
> > If included/required code is added inline in same file, it works fine.
> > >
> > > In test.php3:
> > > <?php
> > > include "$DOCUMENT_ROOT/arrayinit.inc";
> > > // -OR-
> > > require "$DOCUMENT_ROOT/arrayinit.inc";
> > > ?>
> > >
> > > In arrayinit.inc:
> > > // init my array
> > > $myarray = (
> > > "a" => "apple",
> > > "b" => "banana",
> > > "c" => "cherry"
> > > );
> >
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>