You are here: Re: Why does include file text need to be bracketed by <?php> ... <?> « PHP Programming Language « IT news, forums, messages
Re: Why does include file text need to be bracketed by <?php> ... <?>

Posted by gosha bine on 05/28/07 18:20

Michael wrote:
> Since the include function is called from within a PHP script, why
> does the included file have to identify itself as a PHP again by
> enclosing its code in <?php> ... <?>
>
> One would assume that the PHP interpreter works like any other, that
> is, it first expands all the include files, and then parses the
> resulting text. Can anyone help with an explanation?

Unlike, say, C preprocessor instructions or java's imports, php
include() is executed when your script runs, not when it compiles. When
interpreter encounters an "include", it reads the given file and
evaluates its context as php code. "include" is just a confusing name,
"included" files are actually not "embedded" in main file.


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация