Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Dec 2005
    Posts
    3
    Member #
    12160
    Hi everyone,

    I'm pretty new to PHP (and programming in general) but I'm learning fairly quickly. However, there are still concepts that I can't seem to grasp just yet.

    First, what is the difference between print and echo? When should one be used over the other and why?

    Second, can anyone explain what "variable variables" are in newbie (as opposed to an experienced programmer) terms? Why and when are they used?

    Sorry if I sound foolish asking these questions but I'm a designer, not a programmer. My "programming" goes as far as html, css, sql, and a (little) bit of javascript. Thanks in advance.

    MAAD

  2.  

  3. #2
    Junior Member
    Join Date
    Jan 2006
    Posts
    3
    Member #
    12315
    Print cannot take multiple expressions. That is the main distinct difference! Print is a function whereas echo is a language construct , echo has the slight performance advantage because it doesn't have a return value.
    Hope this is clear to you now.

  4. #3
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    With regard to Print vs Echo, there are no practical differences!
    If you're interested anyway, you can read this , (which is supported as the offical difference (from PHP.net))

    With regard to variable variables, you won't come across them too often.
    At your stage, I wouldn't give a damn. You can learn about it later, if you ever encounter a situation where you need them.
    (I had a theoretical understanding of them a few years ago, but could not comprehend why I should ever use them. I eventually came down a path where I had to, and saw the light .)

    Don't worry about it though. When you eventually end up in a situation where you need them, you will know. I would guess that 99,999999% of all scripts ever written, does not rely on variableVariables.

    However, if you just want to check out what they do, look at this thread, which examplify what it is. At the time I found it hillarious (still do), but it explaines the mechanics in a nice orderly way.
    S. Rosland


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:13 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com