View Full Version : PHP version incompatibility

08-15-2007, 05:26 AM
Working on a project at work and home. At work we use PHP 4.3 and home I use WAMP with PHP 5.2. The following snippet from a class I found in public domain. This code works fine on PHP 4.3 but outputs part of the program code in PHP 5.2.

* Returns markup for displaying the calendar.
* @return
* @public
function display ( )
<table border="0" cellspacing="0" cellpadding="0" width="<?=$this->tblWidth?>">
$c = ob_get_contents();
return $c;

The output in the browser is:

dspDayNames()?> dspDayCells()?>

Now I know the issue with short start tags and yes the PHP 4.3 has it turned on and the PHP 5.2 does not - but even if I convert the <? to <?php it still doesn't work. Why? And what is the purpose of <?= anyways? I can't find any reference to this so far in the docs.


08-15-2007, 05:53 AM
...is an echo() shortcut that will only work if short tags are enabled.

Instead of:


<?php echo $this->dspDayNames(); ?>

08-15-2007, 06:12 AM
Beautiful ! Just replaced all the occurances throughout the class and bingo.