I wanna know whats this;

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
omer.farooq
Forum Newbie
Posts: 3
Joined: Sat Jun 21, 2008 6:16 am

I wanna know whats this;

Post 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;?>
User avatar
zplits
Forum Contributor
Posts: 158
Joined: Sun Aug 03, 2008 8:59 pm

Re: I wanna know whats this;

Post 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?
User avatar
Stryks
Forum Regular
Posts: 746
Joined: Wed Jan 14, 2004 5:06 pm

Re: I wanna know whats this;

Post 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.
Post Reply