NYCPHP Meetup

NYPHP.org

Breaking out of PHP mode RE: [nycphp-talk] Can code be executed in a heredoc?

webapprentice at mail.com webapprentice at mail.com
Tue Feb 17 10:51:06 EST 2004


Just to clarify, if I do this...

<?php 
function printForm()
{

  // CODE
?>

// HTML HERE

<?php 

} // end function

?>

Then, the stuff between the PHP blocks is considered part of the function and will only execute when the function is called.  Is that correct?

If that's the case, then thanks for the tips. I can rewrite this function using these tips.

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


>From hans not junk at nyphp.com  Tue Feb 17 10:57:00 2004
Return-Path: <hans not junk at nyphp.com>
Received: from ehost011-1.exch011.intermedia.net (unknown [64.78.21.3])
	by virtu.nyphp.org (Postfix) with ESMTP id C59EBA85E9
	for <talk at lists.nyphp.org>; Tue, 17 Feb 2004 10:56:59 -0500 (EST)
X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Subject: RE: Breaking out of PHP mode RE: [nycphp-talk] Can code be executed
	ina heredoc?
Date: Tue, 17 Feb 2004 07:56:57 -0800
Message-ID: <41EE526EC2D3C74286415780D3BA9F8793745C at ehost011-1.exch011.intermedia.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Breaking out of PHP mode RE: [nycphp-talk] Can code be executed
	ina heredoc?
Thread-Index: AcP1blhlDbAkYcouQYWluaT4bpp0XAAAEUng
From: "Hans Zaunere" <hans not junk at nyphp.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
X-BeenThere: talk at lists.nyphp.org
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: NYPHP Talk <talk at lists.nyphp.org>
List-Id: NYPHP Talk  <talk.lists.nyphp.org>
List-Unsubscribe: <http://lists.nyphp.org/mailman/listinfo/talk>,
	<mailto:talk-request at lists.nyphp.org?subject=unsubscribe>
List-Archive: <http://lists.nyphp.org/pipermail/talk>
List-Post: <mailto:talk at lists.nyphp.org>
List-Help: <mailto:talk-request at lists.nyphp.org?subject=help>
List-Subscribe: <http://lists.nyphp.org/mailman/listinfo/talk>,
	<mailto:talk-request at lists.nyphp.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Feb 2004 15:57:00 -0000


> Just to clarify, if I do this...
>=20
> <?php=20
> function printForm()
> {
>=20
>   // CODE
> ?>
>=20
> // HTML HERE
>=20
> <?php=20
>=20
> } // end function
>=20
> ?>
>=20
> Then, the stuff between the PHP blocks is considered part of=20
> the function and will only execute when the function is=20
> called.  Is that correct?

Correct.

Remember, though, that the function is not returning anything... it's
going directly out to the browser or output buffer.  This has a subtle,
but possibly pertinent effect, ie:

<?php printForm(); ?>

and

<?=3DprintForm()?>


H



More information about the talk mailing list