On Sun, Jan 9, 2011 at 9:56 PM, zer0_gravity <zr...@hotmail.com> wrote:
> Question I have noticed that the following statement works
> interchangeable. Is the equal sign '=' that shorthand version to using
> the echo function?
>
> <?=$variableName['value1'] ;?>
>
> or
>
> <? echo $variable['value1']; ?>

Yes, although the semi-colon should not be used in the first example.
Also, both of those are actullay using the shorthand. All of these are
equivalent:

<?php echo $foo; ?>
<? echo $foo; ?>
<?= $foo ?>

Also (and this is really important), the short_open_tag directive must
be enabled in php.ini to use the shorthand. You should never use the
shorthand if the code may be run on a server that you do not control.
And, even if it will be, you need to consider that short_open_tag may
be disabled sometime in the future. Personally, I much prefer to use
the shortcut than echo. But ONLY with stuff running on servers I
control, and which I'm not particularly concerned about having to move
elsewhere.

http://php.net/manual/en/ini.core.php#ini.short-open-tag
Google "php short_open_tag" if you're in the mood for religious wars.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to