Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple PHP sections in a page - scope...?

9 views
Skip to first unread message

bit-n...@hotmail.com

unread,
Sep 24, 2016, 3:04:35 AM9/24/16
to
If there are 2 or more <?php and ?> sections in one HTML page, can the ones below access variables or functions in the ones above?
What if they're NOT below, ie, is there hoisting?


Thanks.

R.Wieser

unread,
Sep 24, 2016, 3:21:23 AM9/24/16
to
bit-naughty,

> If there are 2 or more <?php and ?> sections in one HTML
> page, can the ones below access variables or functions in the
> ones above?

Yes.

But why didn't you try yourself if it would - or would not - work first ?
:-)

Regards,
Rudy Wieser


-- Origional message:
<bit-n...@hotmail.com> schreef in berichtnieuws
9adaeabd-d192-4f49...@googlegroups.com...

Luuk

unread,
Sep 24, 2016, 3:22:35 AM9/24/16
to
Can you not create a simple page, and test how this works for yourself?

Than would be a great learning expariance... ;)

something like this, in case you do not trust yourself to create such a
simple test:
<?php
$a=1;
?>
<p>HTML1</p>
<?php
print "a=" $a " , b=" $b;
?>
<p>HTML2</p>
<?php
$b=2;
?>
<p>HTML3</p>
<?php
print "a=" $a " , b=" $b;
?>

0 new messages