Why $ symble using in PHP..!

Discussion in 'PHP' started by actress143, May 27, 2010.

  1. #1
    Hello Friends..,

    From long time....., i have doubt in php that

    Why only $ symbol using in PHP., any body know the exact reason.........!

    I need professional answer please tell me any php expert.
     
    actress143, May 27, 2010 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    why whats the problem???

    Because in php we don't initialize variables

    int a = 0;
    double b = 1.00;
    blah blah blah..

    your thinking why not just like an initialized variable?
     
    bartolay13, May 28, 2010 IP
  3. actress143

    actress143 Peon

    Messages:
    132
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ya my intension is why we are using $ symbol like

    $_ bla bla...,,

    instead of remaining symbols.., they are many symbols but why $
     
    actress143, May 28, 2010 IP
  4. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Because it is how they are represented in the language.
     
    lukeg32, May 28, 2010 IP
  5. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #5
    Most likely because PHP was a PERL related script from the start. PERL uses $ to denote variables, so it was likely extended to php.
     
    jestep, May 28, 2010 IP
  6. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #6
    It was initially (PHP/FI) based on Perl, but was then implemented in C so this does isnt right.

    As the end of the day, it doesnt matter what symbol denotes a variable, if any - the fact is, this is how its done in PHP.
     
    lukeg32, May 28, 2010 IP
  7. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #7
    Its just what the PHP language uses, so it can recognise what is a variable. Not sure why the dollar symbol was used, but it does'nt really matter. However if you'd really like a more informative response contact: http://lerdorf.com/
     
    danx10, May 28, 2010 IP
  8. webria

    webria Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    You may not get correct answer from us on this. Nonetheless if you have asked this here answers might be:
    If you mentioned $ every where in php then
    1. you want to know more and more about the $ symbol or
    2. you do not want to know anything about this $ symbol
    3. you do not know why.

    Nonetheless, to me option 3 might be the best answer.
     
    webria, May 28, 2010 IP
  9. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #9
    An Historical issue (Grandfathers BASIC says hello)
    
    5 REM A$ is a variable String  / A% would be an integer
    10 INPUT "Enter your name"; A$
    20 PRINT "Hello, "; A$
    30 INPUT "How many stars to print?"; S
    35 S$ = ""
    40 FOR I = 1 TO S
    50  S$ = S$ + "*"
    55 NEXT I
    60 PRINT S$
    70 INPUT "Want more stars?"; Q$
    80 IF LEN(Q$) = 0 THEN GOTO 70
    90 L$ = LEFT$(Q$, 1)
    100 IF (L$ = "J") OR (L$ = "j") THEN GOTO 30
    110 PRINT "bye bye";
    120 FOR I = 1 TO 200
    130  PRINT A$; " ";
    140 NEXT I
    150 PRINT
    
    Code (markup):
     
    flexdex, May 28, 2010 IP
  10. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #10
    The $ is designated to be unique from present programming languages and to avoid confusion!
     
    roopajyothi, May 28, 2010 IP
  11. actress143

    actress143 Peon

    Messages:
    132
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks friends.., thanks a lot for all your replies.
     
    actress143, May 28, 2010 IP
  12. SalmanAbbas007

    SalmanAbbas007 Peon

    Messages:
    100
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Because Dollar rules the world. :(
     
    SalmanAbbas007, May 31, 2010 IP
  13. powercanon

    powercanon Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Yup definitely =( true
     
    powercanon, May 31, 2010 IP
  14. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #14
    LOL! Thats True too!!
    Because of that PHP Guys selected it ah?? :)
     
    roopajyothi, May 31, 2010 IP
  15. actress143

    actress143 Peon

    Messages:
    132
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    ahh.., funny..., may be true haha.., but i thought what if some one ask this question in interview...! we can say this with little smile but he will ready to expect the accept answer..!
     
    actress143, Jun 1, 2010 IP