tags:

views:

59

answers:

5

Hi everyone

When I write

<?=?>

in my PC it's not working,but it's work in another PC !!! why ??? :( for example :

<?php
$courses = CourseManager::findAll();
?>
<h3>Course List</h3>
<table>
    <tr><th>Name</th></tr>
 <?php   foreach ($courses as $c){
?>
    <tr>
        <td><?=$c->getName()?></td></tr>
  <?php } ?>

</table>

or this, it's too simple no ? :)

<?= expression ?>

This is a shortcut for

<? echo expression ?>

or

<?php
$i ="test";
?>

<h1><?=$i?></h1>

Thanks for your advice :)

+4  A: 

You don't have the short tags enabled.

To enable them look for short_open_tags in php.ini. Change it to "On" and restart Apache.

codaddict
+4  A: 

PHP's short_open_tag options isn't the same on different servers. If possible avoid to use these type of opening tags.

If you want to be sure short open tags are available, set it yourself with ini_set.

fabrik
A: 

Check short_open_tag in php.ini

killer_PL
A: 

Because these shortcuts can be turned off in the php.ini. The option is called short_open_tags.

delnan