Page 1 of 1

Simple Q

Posted: Sat Sep 12, 2009 11:13 am
by vlads
Hello, I don't know so sure if it's ok to ask just a simple q, but I try so: What's the difference between:

Code: Select all

<?php $var['name']; ? >
and

Code: Select all

<?=$var['name']; ? >
and

Code: Select all

<?php echo $var['name']; ? >
,in a xhtml string. I'm asking this because in my scrip code I have the first version (<?php $var[name];?>) and it don't appear running localhost with easyphp, just if I put echo. Can it be a server problem or...? Because on the paid hosting server it is running.

Thanks, and hope to get an answ
(sorry for my bad engl)

Re: Simple Q

Posted: Sat Sep 12, 2009 11:24 am
by Darhazer
<?php $var['name']; ? >
do nothing
<?=$var['name']; ? >
is the short version of
<?php echo $var['name']; ? >
The short version requires that short_open_tag is allowed

Re: Simple Q

Posted: Sat Sep 12, 2009 12:10 pm
by vlads
Thanks for the fast reply.

I don't know how it works on the paid server, but I see that the whole script is written so:

Code: Select all

<td><a href="index.php?page=xxx&xxx=<?php $sc['xxx'];?>" class="xxx">&raquo; <?php $sc['xxx'];?></a></td>
 
                            </tr>
 
                            <tr>
 
                                <td class="xxx"><?php nl2br(substr($sc['xxx'], 0, 100));?> ...</td>
 
                            </tr>
 
...so how it's possible this?