Question about PHP coding – using several <?php ?>
-
I see this type of coding all over the place in WordPress:
<?php if (!is_paged() && is_home()) { ?>current_page_item<?php } else { ?>page_item<?php } ?>" id="header-menu-home"><a href="<?php echo get_settings('home'); ?>/"><?php _e('HOME','piano-black'); ?></a>
I’m confused!
I always thought every bit of PHP code was self contained – i.e. start with <?php and end with ?>
I thought all code went in thereIs it OK to start and stop code as above and have several instances of <?php ?>
(Obviously it must be!)
Do variables carry over from one instance to another?ALSO: WHY would you want to do it the way above? Why not have everything inside one <?php ?>
THANKS!
Omar
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Question about PHP coding – using several <?php ?>’ is closed to new replies.