Re[3]: [PHP] print vs heredoc

From: Date: Tue, 08 Jul 2003 08:26:45 +0000
Subject: Re[3]: [PHP] print vs heredoc
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154319@lists.php.net to get a copy of this message
Hi. I'm surprised you haven't been jumped on already for this one. Variables in double-quoted and heredoc-style strings are expanded; variables in single-quoted strings aren't. I refer you to the excellent PHP manual -- one of the first pages you should absorb... http://www.php.net/manual/en/language.types.string.php >Hi, > >Tuesday, July 8, 2003, 5:22:04 PM, you wrote: >TR> Hi, > >>>> btw what would be nice is a print_raw command that does no >>>> parsing just sends the stuff :) >>>> (Would be good for template systems where you know there is no php >>>> hidden in there.) ... might gain a couple of micro seconds > >PO>> I believe this is called "breaking out of PHP mode >PO>> and into HTML mode", which can be done anywhere, at >PO>> any time. > >PO>> Regards, >PO>> Philip > >TR> No .. what I was talking about is echoing a variable that contains no >TR> php > >TR> $test = 'Hi there'; >TR> echo $test; > >TR> $test will get parsed (i believe) looking for stuff to interpolate. >TR> Could be a waste of time in some cases where $test is large. >TR> But again probably insignificant with regard to actual time to get it >TR> to the client. > >TR> -- >TR> regards, >TR> Tom > > >Ok I think I have succeeded in confusing myself :) >It seems the interpolation is done at the time of assignment and not >the actual echo.. > >-- >regards, >Tom

« previous php.general (#154319) next »