Basic PHP question |
(08-08-2019, 09:27 AM)John_Betong Wrote: > @Dave friend I used the phrase "dropping into and out of PHP mode" which is not an entirely accurate description of what is going on. I'd say "My bad" except even the PHP manual uses a variation on that phrase. It's not that the PHP processor is being turned off and on. Rather, it is that anything not contained within <?php ?> tags is ignored by the PHP compiler and passed directly to the web browser. So, "dropping out of PHP mode" is really only a matter of whether the script is sent to the parser or sent directly to the browser. So I must stick with the idea that there isn't any performance hit for switching modes. Because all code inside of <?php ?> must be interpreted by PHP it will take longer to be passed to the browser. Admittedly, in many circumstances, we're looking at a micro-optimization here. However, per the PHP manual (here) PHP Manual Wrote:For outputting large blocks of text, dropping out of PHP parsing mode is generally more efficient than sending all of the text through echo or print. For me it's all about which one looks cleaner, is easier to write and to maintain. |
Messages In This Thread |
Basic PHP question - by ronniebel - 08-06-2019, 04:22 PM
RE: Basic PHP question - by includebeer - 08-06-2019, 05:14 PM
RE: Basic PHP question - by John_Betong - 08-06-2019, 11:12 PM
RE: Basic PHP question - by albertleao - 08-06-2019, 11:20 PM
RE: Basic PHP question - by includebeer - 08-07-2019, 02:57 AM
RE: Basic PHP question - by dave friend - 08-07-2019, 06:28 AM
RE: Basic PHP question - by John_Betong - 08-08-2019, 09:27 AM
RE: Basic PHP question - by includebeer - 08-08-2019, 10:12 AM
RE: Basic PHP question - by dave friend - 08-08-2019, 12:10 PM
RE: Basic PHP question - by kilishan - 08-08-2019, 02:27 PM
|