Stacks in PHP
Moderator: General Moderators
Stacks in PHP
I have only started learning what are stacks, (only in Pascal, since that's what they teach in my schol) and I have been wondering out loud
if there are predefined stacks in PHP, or should I write a function or functions or even a class that takes care of stacks.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
In PHP you can use arrays as stacks with array_push(), array_pop(), array_shift(), array_unshift() and array(). There's also the empty() function too. There's a school still teaching Pascal!?
Array Functions
Array Functions
Actually, Pascal lends itself to teaching fairly well. It was widely used for quite a long time for just that reason.Buddha443556 wrote:There's a school still teaching Pascal!?
It does a good job emphasizing structured programming, and the somewhat limited keyword list makes it accessible for newcomers.
OOP however, isn't the best fit in Pascal, imho.
My personal pet peeve lately is the over-emphasis on Java as a teaching language. Its really rather horrid for newcomers.. it has a steep learning curve, you have to learn multiple libraries to do anything even remotely useful, and honestly, the reward/reinforcement is low.. you have to do a lot of programming in Java to get a simple result.
The key for newcomers is to give them a language that rewards them quickly: Show them that what they type in makes the computer do something. Once you get that hook in, then you can work on getting to program effectively.
As I have a long pascal history, I couldn't resist ...
The reason is not "somewhat limited keyword list", because Pascal's keyword list is quite on the level. Well, was on the level at the time of last Borland Pascal (11 years ago or so?), so the "keyword list" you are refering to is either very old or completely on the level. Even free pascals have gone a long way from there.
I am actually not sure -- they're not teaching them Turbo Pascal 6.0, are they? This would put things into a different perspective.
Best regards,
g
It is a good language for learning, but that is only because it has a human-readable syntax. Not many begginers love to see {}() and strange for-syntax all around, which is the case with c-like languages.Roja wrote: Actually, Pascal lends itself to teaching fairly well. It was widely used for quite a long time for just that reason.
It does a good job emphasizing structured programming, and the somewhat limited keyword list makes it accessible for newcomers.
The reason is not "somewhat limited keyword list", because Pascal's keyword list is quite on the level. Well, was on the level at the time of last Borland Pascal (11 years ago or so?), so the "keyword list" you are refering to is either very old or completely on the level. Even free pascals have gone a long way from there.
I am actually not sure -- they're not teaching them Turbo Pascal 6.0, are they? This would put things into a different perspective.
Again, I get the feeling that you're either refering to a 10+ year old language or just aren't familiar with it. All modern pascals are excellent for OOP. Actually, they were already excellent years ago. But, again, I don't really know which pascal they're learning ...Roja wrote: OOP however, isn't the best fit in Pascal, imho.
Best regards,
g
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
It's been a lot longer than 10 years for me. My Pascal is a couple of decades out of date. I think Pascal would be an excellent learning tool if it does support modern OOP. Hope Pilau comes back with some more details.dbevfat wrote:Again, I get the feeling that you're either refering to a 10+ year old language or just aren't familiar with it. All modern pascals are excellent for OOP. Actually, they were already excellent years ago. But, again, I don't really know which pascal they're learning ...Roja wrote: OOP however, isn't the best fit in Pascal, imho.
I agree with the point about human-readable syntax being a large draw, but I still think the keyword list is a good fit too.dbevfat wrote:It is a good language for learning, but that is only because it has a human-readable syntax. Not many begginers love to see {}() and strange for-syntax all around, which is the case with c-like languages.
Pascal many moons ago became assimilated into the borg that became Delphi. Delphi is a totally different beast, fitting a completely different description - which makes me glad they changed the name.dbevfat wrote:The reason is not "somewhat limited keyword list", because Pascal's keyword list is quite on the level. Well, was on the level at the time of last Borland Pascal (11 years ago or so?), so the "keyword list" you are refering to is either very old or completely on the level. Even free pascals have gone a long way from there.
The last pascal *I* am aware of being called pascal was TBPascal 7, which by that point had been mated with OOP to produce an offspring more hideous than VB - a feat that must be given respect!
When I say pascal, I mean the true, original pascal, ye unto TP 5.0, before the introduction of the first object support (5.5).
That was my take. Generally, if they are using newer than 6.0, they refer to it as Delphi, which is most definitely a whole nother ball of wax.dbevfat wrote:I am actually not sure -- they're not teaching them Turbo Pascal 6.0, are they? This would put things into a different perspective.
HEY! I resemble that remark.dbevfat wrote:Again, I get the feeling that you're either refering to a 10+ year old language or just aren't familiar with it. All modern pascals are excellent for OOP. Actually, they were already excellent years ago. But, again, I don't really know which pascal they're learning ...
I did do Pascal over a decade ago, so yes, I am referring to that one. If you meant Delphi, perhaps you could clarify.. or better, Pilau could.
My bad, I apologizeRoja wrote:HEY! I resemble that remark.
I did do Pascal over a decade ago, so yes, I am referring to that one. If you meant Delphi, perhaps you could clarify.. or better, Pilau could.
People are actually confused what's Pascal and what's Delphi, and I am not surprised at all.
The fact is they didn't name the language Delphi at first, it was actually only the name of the RAD tool, not language. The language was called ObjectPascal at the time Delphi 1 came out, and it wasn't named "Delphi" until a few versions later.
But the name ObjectPascal originates from the last version of Borland Pascal (was that 7.0?). It was Borland Pascal (which is different than Turbo Pascal, because it had OOP support) that introduced ObjectPascal, which was a very fine object-oriented language.
At least I think I remember it was so, who would actually know with all those names and whatever
Regards
ObjectPascal != Pascal.dbevfat wrote: People are actually confused what's Pascal and what's Delphi, and I am not surprised at all.
The fact is they didn't name the language Delphi at first, it was actually only the name of the RAD tool, not language. The language was called ObjectPascal at the time Delphi 1 came out, and it wasn't named "Delphi" until a few versions later.
Actually, OOP was added in 5.5, 6.0 was the first that changed the name, and 7.0 was sort of a hedged bet, for people that might not like the "Delphi" name and the full OOP-ification.dbevfat wrote: But the name ObjectPascal originates from the last version of Borland Pascal (was that 7.0?). It was Borland Pascal (which is different than Turbo Pascal, because it had OOP support) that introduced ObjectPascal, which was a very fine object-oriented language.
To calrify things (sorry it took me three days but, 12th grade isn't easy), they're teaching us what I believe to be TurboPascal 5.0, on compilers of TP 7.0 (go figure Israeli Ministry of Education officers). And I say that because we aren't learning objects, so that means we're one or two versions back.
We might be learning TurboPascal version 7, but that would be version 7.0 without the OOP. (if there is OOP support in TurboPascal).
Anyway, most schools starting from next year would switch to C# (Israeli schools that is to say.)
Shame I'm finishing school this year
However, some schools teach the C and BASIC programming languages. Which I believe are better as a start, since Pascal isn't as useful today as it were 10+ years ago. (Not that it was THAT useful back then
)
We might be learning TurboPascal version 7, but that would be version 7.0 without the OOP. (if there is OOP support in TurboPascal).
Anyway, most schools starting from next year would switch to C# (Israeli schools that is to say.)
Shame I'm finishing school this year
However, some schools teach the C and BASIC programming languages. Which I believe are better as a start, since Pascal isn't as useful today as it were 10+ years ago. (Not that it was THAT useful back then
Pascal is an excellent language, way better for beginners than C and way better for ANY level than BASIC, and after all it doesn't really matter where you learn basics, BUT the fact that they're not teaching you OOP is beyond my understanding of "proper education" ...pilau wrote:However, some schools teach the C and BASIC programming languages. Which I believe are better as a start, since Pascal isn't as useful today as it were 10+ years ago. (Not that it was THAT useful back then)
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
If your learning algorithms and data structures, Pascal is a good choice. Pascal might be easier for beginners than C. Certainly better than BASIC for learning algorithms and data structures. Never used C# but it seems more like Java than C or C++ to me - that's good IMO. Hope you get to learn them all, Pilau, and OOP too.
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
Maybe drop 1 year then....pilau wrote:Anyway, most schools starting from next year would switch to C# (Israeli schools that is to say.)
Shame I'm finishing school this year![]()
Here, they have BASIC from 3rd-8th grade, C++ in 9th-10th and Java/LINUX in 11th-12th grade. So we get experience in every language
Thanks for the invitation lol ^^n00b Saibot wrote: Pilau, you can come over to mine place for completing your final yearyou will get to learn Java with Linux thrown in.
After I'm finishing school I'm going to the IDF (Israeli Defence Forces) M.M.R.M programming unit (Hebrew: ממר"ם). It is a course of 6 months where they teach you TONS and I mean TONS of programming languages. (you start learning at 8 in the morning and finish at 9 p.m.). They even teach you Scheme
So I'll guess that by that time I'll already have OOP in my pocket.
P.S.: many students from the computers class in my school have made it to the M.M.R.M programming unit.
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
I hate all of you.... the only computer class my high school had was learning how to use your computer and it was required! I wanted to kill myself sooooooooo bad. Either way, then my college was still teaching Cobol!!!!!!!!!!!!!!!!!!!!!!!! :O But, they changed to c++ this year, thank God. I was about to switch colleges because of that crap...