Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.
Moderator: General Moderators
Charles256
DevNet Resident
Posts: 1375 Joined: Fri Sep 16, 2005 9:06 pm
Post
by Charles256 » Thu Aug 03, 2006 10:20 am
no amtter how much you want it to be PHP is not c++...keep trying to code my classes like it was c++..it just ain't working..doh..
MrPotatoes
Forum Regular
Posts: 617 Joined: Wed May 24, 2006 6:42 am
Post
by MrPotatoes » Thu Aug 03, 2006 10:42 am
i know right? it's close tho. so it's not all bad
Charles256
DevNet Resident
Posts: 1375 Joined: Fri Sep 16, 2005 9:06 pm
Post
by Charles256 » Thu Aug 03, 2006 10:59 am
can't tell you how many times i've went for(int i=0;i<10;i++) and then take a minute to figure out why it isn't working.lol
MrPotatoes
Forum Regular
Posts: 617 Joined: Wed May 24, 2006 6:42 am
Post
by MrPotatoes » Thu Aug 03, 2006 1:49 pm
Charles256 wrote: can't tell you how many times i've went for(int i=0;i<10;i++) and then take a minute to figure out why it isn't working.lol
yeah, i'm not really a fan of the '$'. but i guess since i don't have to bothe with pointers and strings i guess it's ok.
but i would like pointers tho. it would be nice to be able to control memory but honestly, what can i expect/demand from a script language? lmao
Ollie Saunders
DevNet Master
Posts: 3179 Joined: Tue May 24, 2005 6:01 pm
Location: UK
Post
by Ollie Saunders » Fri Aug 04, 2006 9:49 am
Yep, I don't really like the dollars either.
I did this for some reason.
Code: Select all
$a=1;$b='o';$j=5;$o=9;$c='b';$e=2;$u='c';$m=4;
echo $$$u; // what's the output?
Charles256
DevNet Resident
Posts: 1375 Joined: Fri Sep 16, 2005 9:06 pm
Post
by Charles256 » Fri Aug 04, 2006 9:52 am
maybe 9? you and your damn variable variable variables. if it's 9 i say it should be a compiler error that you're a moron. : hugs for ole: no hard feelings, i know you were just making a point.
Ollie Saunders
DevNet Master
Posts: 3179 Joined: Tue May 24, 2005 6:01 pm
Location: UK
Post
by Ollie Saunders » Fri Aug 04, 2006 10:24 am
lol, yep it was supposed to be annoying. In fact the answer is 'o'
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Fri Aug 04, 2006 10:25 am
You know, when I was looking at ColdFusion, VBScript, C#.NET an VB.NET (and C++) the only thing I could think of was...
"Man, this would be so much easier if there some freaking dollar signs..."
panic!
Forum Regular
Posts: 516 Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK
Post
by panic! » Fri Aug 04, 2006 10:28 am
$ are very BASIC.
if PHP had pointers...wow that would be awesome, dunno how practical that would be on shared servers.
Ree
Forum Regular
Posts: 592 Joined: Fri Jun 10, 2005 1:43 am
Location: LT
Post
by Ree » Fri Aug 04, 2006 11:05 am
I'm wondering what's the point of having $ before variable names? What were they thinking???
Charles256
DevNet Resident
Posts: 1375 Joined: Fri Sep 16, 2005 9:06 pm
Post
by Charles256 » Fri Aug 04, 2006 11:12 am
actually. the $ sign does have benefits..it screams at you "hey! I'm a variable!" in c++ and other languages you have to know what the key words are to know what the variables are.that or have a descent IDE
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Fri Aug 04, 2006 11:14 am
Ree wrote: I'm wondering what's the point of having $ before variable names? What were they thinking???
Rasmus developed PHP from Perl, which also uses '$'.
Ree
Forum Regular
Posts: 592 Joined: Fri Jun 10, 2005 1:43 am
Location: LT
Post
by Ree » Fri Aug 04, 2006 11:17 am
Yeah, I'm not sure about Perl but I think Ruby uses different prefixes for variable names ($, @ etc) and those have a meaning (such as global var, instance var etc). In php the prefix is not needed at all and I would be happy if it was removed (not that it's going to ever happen though).
Ollie Saunders
DevNet Master
Posts: 3179 Joined: Tue May 24, 2005 6:01 pm
Location: UK
Post
by Ollie Saunders » Fri Aug 04, 2006 11:33 am
actually. the $ sign does have benefits..it screams at you "hey! I'm a variable!"
Yeah that is true which means you can do this:
Which is a no no in many languages.
Thing that bothers me though is, if variables have a dollar and functions have (), what do constants have? what do class names have?
You could leave class names plain but it would be nice to have a % prefix for constants.
Code: Select all
%numMonkeys = 5;
echo %numMonkeys;
%numMonkeys = 10; // E_FATAL