<?= and <?php and <?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ubccis@gmail.com

    <?= and <?php and <?

    What are the differences between using these?

    <?= and <?php and <?

  • Justin Koivisto

    #2
    Re: &lt;?= and &lt;?php and &lt;?

    Only "<?php" is enabled on *all* servers

    to use the others, short_open_tags must be "On" in php.ini.
    "<?=$variable?> " is equivalent to "<?php echo $variable ?>"

    Comment

    • John Dunlop

      #3
      Re: &lt;?= and &lt;?php and &lt;?

      An anonymous being wrote:
      [color=blue]
      > What are the differences between using these?
      >
      > <?= and <?php and <?[/color]

      The differences are outlined in the Manual, together with
      recommendations on which to use.



      --
      Jock

      Comment

      • Alvaro G. Vicario

        #4
        Re: &lt;?= and &lt;?php and &lt;?

        *** ubccis@gmail.co m escribió/wrote (27 Jan 2005 11:50:33 -0800):[color=blue]
        > What are the differences between using these?
        >
        > <?= and <?php and <?[/color]

        <? is shorthand for <? echo

        The PHP manual explains it better than I could:

        "There are four sets of tags which can be used to denote blocks of PHP
        code. Of these, only two (<?php. . .?> and <script language="php"> . .
        ..</script>) are always available; the others can be turned on or off from
        the php.ini configuration file. While the short-form tags and ASP-style
        tags may be convenient, they are not as portable as the longer versions.
        Also, if you intend to embed PHP code in XML or XHTML, you will need to use
        the <?php. . .?> form to conform to the XML."



        The <script> alternative exists because of certain issues with some HTML
        editors such us Front Page.



        --
        -+ Álvaro G. Vicario - Burgos, Spain
        +- http://www.demogracia.com (la web de humor barnizada para la intemperie)
        ++ Manda tus dudas al grupo, no a mi buzón
        -+ Send your questions to the group, not to my mailbox
        --

        Comment

        • ubccis@gmail.com

          #5
          Re: &lt;?= and &lt;?php and &lt;?

          Thanks...this is a big help.
          Just wondering, in the future, how do you recommend me to search for
          answers to syntax related questions? For example, Google does not
          allow searches such as '<?='.

          Thanks

          Matt L

          Comment

          • Alvaro G. Vicario

            #6
            Re: &lt;?= and &lt;?php and &lt;?

            *** ubccis@gmail.co m escribió/wrote (27 Jan 2005 13:07:51 -0800):[color=blue]
            > Just wondering, in the future, how do you recommend me to search for
            > answers to syntax related questions? For example, Google does not
            > allow searches such as '<?='.[/color]

            The PHP manual is a great source of information:


            PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


            I recommend the "Extended HTML Help" download if you are a Windows user.
            Most of your questions are probably covered in the "Language Reference"
            chapter:



            The rest is just a matter of intuition and common sense. Since you
            absolutely need to use <? to execute any code, that must be explained in
            the very first page :)

            --
            -+ Álvaro G. Vicario - Burgos, Spain
            +- http://www.demogracia.com (la web de humor barnizada para la intemperie)
            ++ Manda tus dudas al grupo, no a mi buzón
            -+ Send your questions to the group, not to my mailbox
            --

            Comment

            • ramiro

              #7
              Re: &lt;?= and &lt;?php and &lt;?

              <?= is enabled by default in PHP, is a shortcut for print a variable
              content or a functions return. It's just like the ASP <%=
              Regards,
              Ramiro Varandas Jr.

              Comment

              Working...