Skip to content

Instantly share code, notes, and snippets.

@bnvk
Created September 23, 2010 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnvk/593059 to your computer and use it in GitHub Desktop.
Save bnvk/593059 to your computer and use it in GitHub Desktop.
I just encountered a weird little quirk of PHP that I spent awhile trying to resolve, so I'm posting this as a Google search turns up nothing.
When including a .php file in the midst of an html/view file using the include() function:
<?= include('myfile.php') ?>
Was producing a number '1' located after the end of include. The issue turns out to be a bug / feature or using short tags:
<?=
as opposed to:
<?php include('myfile.php'); ?>
the problem is that the short translates to:
<?php echo include('myfile.php'); ?>
which also produces the '1' hopefully this helps someone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment