Cases where php's short tags should be avoided

David Carr

1 min read - 8th Feb, 2017

When designing my email layout files I like to break them down into parts and include them together as needed using includes. I've stumbled across a display issue when using a short tag include:


This caused a 1 to be displayed where the file is being included. Which when you think about it kind of makes sense since short tags are meant for simple variable output and not a chunk of HTML. So when run they are essentially booleans (true) to avoid this I stopped using short hand:

<?php include('Layouts/Header.php');?>


Add a comment

Copyright © 2006 - 2024 DC Blog - All rights reserved.