7Answers
  • 3
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Difference between <?php and <?

I am new to php and would like to know if there are any differences between these server tags :

<?php
?>

and

<?
?>

The problem with short open tags is that the following:

<?xml version="1.0" ?>

will cause problems if you're allowed to use short tags (i.e. <? and ?>). <?php is less open to misinterpretation.

Whether or not you're allowed to use short tags is defined by the ini directive short_open_tag.

  • 41
Reply Report

Also I think shorttags are being removed in one of the upcomming releases.

Edit: I was wrong.

Farewell <% They will remove support for the ASP style tags, but the PHP short-code tag will remain - so to those on php general who reckon the short-tag is 'depreceated' - hah! ;)

http://phpmysqldev.blogspot.com/2007/05/php-6.html

  • 3
Reply Report

As @erenon explained here: https://stackoverflow.com/a/1808372/1961535

The difference is that short_open_tag in some cases isnt available. You can check the status by accessing the php.ini file but in case of shared hosting server, the host does not always allow edits to php.ini file.

You can easily print the phpinfo as explained here: https://www.php.net/manual/en/function.phpinfo.php

phpinfo();

search for short_open_tag as shown below

enter image description here

It is always better to use full tag because that will always be supported in every version of PHP weather old file or new.

  • 0
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions