In PHP, what does <?=$varname ?> do?

apinomus

Senior member
Dec 14, 2005
394
0
0
<?=$varname ?>

In the code I'm looking at it seems like it's a short-cut print command, but does it take into account any conditionals like if() ? Thanks :)
 

Drakkon

Diamond Member
Aug 14, 2001
8,401
1
0
just a shortcut of the print commmand cant use any more code in it than a one liner thing...but something like this:
<?=($varname)? $var1 : $var2 ?>

can work ;)
 

apinomus

Senior member
Dec 14, 2005
394
0
0
<?=($varname)? $var1 : $var2 ?>
What long-form code does that translate into? Any links on where to learn more about short-cuts like that?
 

Drakkon

Diamond Member
Aug 14, 2001
8,401
1
0
if($varname) {
print $var1;
} else {
print $var 2;
}

learned all i know from php.net and the chm manual :D