Web Analytics Made Easy -
StatCounter <?=$stuff?> - CodingForum


No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts

  • <?=$stuff?>

    What do you think of the ability to print a variable just by using the = sign and the variable name inside the PHP tags?

    The poll is expired.

    Jared Brandt

  • #2
    Who wouldn't like the option!
    Last edited by WA; Jul 12, 2002, 11:37 PM.
    Jared Brandt


    • #3
      The only downfall as far as I'm aware of using <?= as oposed to
      <?php echo is... you'll not get a good validation return toward
      XHTML compliance.

      If you're using a nice modern version of PHP it does cut down on
      the ol' filesize by 7 bytes
      ضkii - formerly pootergeist
      teckis - take your time and it'll save you time.


      • #4
        And I just slaved over this computer for a few days and finally came out with my almost finsihed product of 12KB and I must say I used it a lot... Well, you know what they say 12KB is better than 13KB (although I'm sure I didn't use it THAT much, anyway)!
        Jared Brandt


        • #5
          I guess it could be useful in certain circumstances, but then again, good ol' <? echo(" "); ?> could be needed at times


          • #6
            Who voted no there?!

            The <?=$text?> syntax is great, and is one of the only things ASP has going for it...


            • #7
              Originally posted by Mouldy_Goat
              Who voted no there?!
              I did

              Just because I didn't know it existed; "Do you ENJOY of this ability?" that's why

              But then, who's the other one who voted no?

              Mzzl, Chris
              My Website


              • #8
                Originally posted by Mouldy_Goat
                Who voted no there?!

                The <?=$text?> syntax is great, and is one of the only things ASP has going for it...
                I voted no as I see little benefit over current syntax, I'm no php-guru so maybe I'm wrong but it may cause problems when you don't want to print the variable such as loading it into a *.swf amongst other things.
                [+] Computer/PC issues [+] Silverpaw3D
                Never buy a dwarf with learning disabilities...

                ...it's not big, and it's not clever.


                • #9
                  Why is this poll closed already - after two days and 7 votes?

                  Anyway, I vote for "No", because I hardly see any great benefits from this shortcut option. Does it work also when short_open_tags is disabled (for working in XML documents)? I'm a bit skeptic there.
                  I tend to favor things more in the long run that are still readable after a project is finished two months ago. And with this shorthand syntax, it could be another server-side language.

                  <?php echo $foo; ?> gets my support, though I try to avoid cluttering the HTML source with lots of simple variable echos.
                  De gustibus non est disputandum.


                  • #10
                    One of the first things that grabbed me about PHP was not that there seemed to be a way to do everything I wanted but that there were often several ways of doing it, I think this is the case here, most non PHP'ers could guess what <?=$str;?> meant in a second or so.

                    But I think the whole point here is for non-coders, i.e. designers who want to include pre-written features, I have just written a few forms for a client and all the client has to do is insert


                    or whatever - wherever he wants it to appear in his page.

                    of course
                    <? echo ("$client_application_form");?>
                    <? echo $client_application_form;?>
                    <?print ("$client_application_form");?>
                    + printr() & surreal combos of include & readfile & implode(,file())etc etc all work, but for a non-programmer the first causes less confusion, ok its hard to get <? echo $this;?> wrong but they do !

                    also its less typing so I use it wherever I can
                    resistance is...

                    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)