Page 1 of 1

I wanna know whats this;

Posted: Fri Aug 22, 2008 6:39 am
by omer.farooq
Hi all,

I just went thru a snippet and i found this tag or syntax written in php, can any body help

<?=$host;?>

Re: I wanna know whats this;

Posted: Fri Aug 22, 2008 7:03 am
by zplits
hi there.

as to what i have understand about php

<?=$host?>

the <? is the beginning tag of every php script, It tells the server that there is something that the server needs to process. Mostly you'll find this <?php... While ?> is the end tag of <?

the = sign is for equality. and the $host is a variable. Variables are written with a $ sign at the beginning.

Where did you find this script?

Re: I wanna know whats this;

Posted: Fri Aug 22, 2008 8:10 am
by Stryks
My understanding is that that code is shorthand for ...

Code: Select all

<?php echo $host; ?>
This expanded form is a far better practice as far as I'm concerned ... if for no other reason than because of the issue you pointed out. It's just more readable / understandable.