For some reasons my php code does not work unless i put the php keyword after the ? in my code as shows in the following example. <?php echo "Hello"; ?> Code (markup): The above code works <? echo "Hello"; ?> Code (markup): The above code does not work What settings do i need to do to make the second code work? Thanx
allow_short_tags needs to be enabled in your php.ini PHP's official opening tag is infact <?php, <? is a short version, not all servers support it.
There should be a short_open_tag in your PHP.ini and as of right now it's set to Off I imagine. So just set it to On and restart the web server and you should be able to use <? . Of course <? is a deprecated feature is it that hard to type <?php ?
i would recommend sticking with <?php personally as it'll work on any server. you don't have to worry about short tags being enabled or not. and plus that, it's only 3 extra characters. and thank god for asp style tags <% %> disappearing in php6
yes <?php should be used.there is not much work need to write those 3 letters(php) but it will save you u from lot of problem