SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2006
    Posts
    443
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how php interpreter read the php code?

    Does it read the file line by line and check even HTML and JScript at first! or does if search for <?php ?> and read what is between?

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    the PHP processor ignores everything not enclosed inside <?php ?>, <? ?>, <&#37; %>, or <script language='php'></script> tags. Note that everything except <?php ?> is considered deprecated.

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    It basically process everything in the PHP tags (as StarLion said), then sends the generated page to the user. Once it's there it processes HTML and Javascript (just like any page without PHP would).

  4. #4
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by samanime View Post
    It basically process everything in the PHP tags (as StarLion said), then sends the generated page to the user. Once it's there it processes HTML and Javascript (just like any page without PHP would).
    The interpreter ignores the HTML. Apache serves the processed PHP output and the HTML to the client.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  5. #5
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    The interpreter ignores the HTML. Apache serves the processed PHP output and the HTML to the client.
    You misunderstand what sam said.

  6. #6
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Yeah, sorry for the misunderstanding. I basically said what you said.

    PHP takes PHP tags and makes page with any generated HTML in place, then it's served up (by Apache/IIS) like any other HTML page. PHP interpreter ignores anything outside of PHP tags and it's just left there.

  7. #7
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Yep, I misread that. Going back and looking at it again at what samanime said makes sense.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  8. #8
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    62 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Quote Originally Posted by StarLion View Post
    Note that everything except <?php ?> is considered deprecated.
    Uhh, not true. None of those styles of tags are deprecated. However, short tags and ASP-style tags are recommended against, in the name of portability, and very few people use the <script> tags.
    Salathe
    Software Developer and PHP Manual Author.

  9. #9
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Salathe View Post
    Off Topic:



    Uhh, not true. None of those styles of tags are deprecated. However, short tags and ASP-style tags are recommended against, in the name of portability, and very few people use the <script> tags.
    Quoted from the php|architect's Zend PHP 5 Certification Study Guide:
    "Short tags, script tags and ASP tags are all considered deprecated and their use is strongly discouraged".

  10. #10
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    That's Zend. The official vanilla PHP guide says that they are all still valid.

  11. #11
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by samanime View Post
    That's Zend. The official vanilla PHP guide says that they are all still valid.
    Valid does not mean they're not -considered- deprecated. Your Next Generation consoles play previous generation console's games. The previous generation are still considered deprecated, even though they're still valid in the new machine.

  12. #12
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Well, I'll rephrase: there is absolutely no mention of them being deprecated in the official vanilla PHP guide.

    Granted this is a mute point though. I don't know why anyone would really both using anything other than <?php ?> for any reason other than just being a bit stubborn.

  13. #13
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    62 Post(s)
    Tagged
    0 Thread(s)
    They are not deprecated (considered so, or otherwise), but short tags and ASP-style tags are, as the Zend guide points out, not recommended as I said earlier. I feel that I can speak for the PHP documentation group here in qualifying that if something is deprecated in PHP, it will emit an E_DEPRECATED; if it does not, then it is simply not a deprecated feature. Sorry I tried to clarify the situation for others, next time I'll keep my trap shut.
    Salathe
    Software Developer and PHP Manual Author.

  14. #14
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    Well then i'd suggest the PHP Documentation group contact the people who are producing their study guide and telling them they got it wrong....

    (Even the new Zend-Online 5.3 guide lists only the <?php ?> and <script> tag formats)

  15. #15
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    62 Post(s)
    Tagged
    0 Thread(s)
    The PHP docs team has nothing to do with php|architect nor their study guides. I'm not entirely sure where you're trying to go with this so would ask that we perhaps steer the discussion back on topic?
    Salathe
    Software Developer and PHP Manual Author.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •