Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.

View Poll Results: Do you ENJOY of this ability?

Voters
7. You may not vote on this poll
  • Yes

    5 71.43%
  • No

    2 28.57%
Results 1 to 10 of 10

Thread: <?=$stuff?>

  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Regina, Saskatchewan, Canada
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 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?
    Jared Brandt
    IKinsler

  • #2
    New Coder
    Join Date
    Jul 2002
    Location
    Regina, Saskatchewan, Canada
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Who wouldn't like the option!
    Last edited by WA; 07-13-2002 at 04:37 AM.
    Jared Brandt
    IKinsler

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    New Coder
    Join Date
    Jul 2002
    Location
    Regina, Saskatchewan, Canada
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    IKinsler

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess it could be useful in certain circumstances, but then again, good ol' <? echo(" "); ?> could be needed at times

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Who voted no there?!

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

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    the Netherlands
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    North East England
    Posts
    853
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #10
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    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

    <?=$client_application_form;?>

    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)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •