a general notice...

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

a general notice...

Post by Charles256 »

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.. :-D
User avatar
MrPotatoes
Forum Regular
Posts: 617
Joined: Wed May 24, 2006 6:42 am

Post by MrPotatoes »

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 »

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
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

:roll: not seeing it either

:wink: :wink:
User avatar
MrPotatoes
Forum Regular
Posts: 617
Joined: Wed May 24, 2006 6:42 am

Post by MrPotatoes »

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
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

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 »

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. :-D
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

lol, yep it was supposed to be annoying. In fact the answer is 'o'
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

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..." Image
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Post by panic! »

$ 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 »

I'm wondering what's the point of having $ before variable names? What were they thinking??? :roll:
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

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 :-D
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Ree wrote:I'm wondering what's the point of having $ before variable names? What were they thinking??? :roll:
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 »

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).
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

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:

Code: Select all

$array = array();
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
Post Reply