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.
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?
ya my intension is why we are using $ symbol like $_ bla bla...,, instead of remaining symbols.., they are many symbols but why $
Most likely because PHP was a PERL related script from the start. PERL uses $ to denote variables, so it was likely extended to php.
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.
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/
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.
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):
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..!