+36  A: 

First we need to know what a programming language is. At its minimum, a programming language is something that is read by the computer and instructs it to perform certain operations. Many people would also expect a general purpose programming language to be Turing complete. However there could be situations where a domain-specific language isn't Turing complete but is still a useful programming language for that specific domain. Programming languages can be compiled or interpreted, and they could run on many platforms or just one specific one. Different needs require different programming languages. Clearly PHP is a programming language.

My definition of "real" programming language would be any programming language that has at least one practical usage in the real world. This is opposed to an esoteric programming language which typically has no practical usage. Since PHP is used widely to solve real problems it easily meets this requirement for being a real programming language, although it is arguably not a particularly beautiful language.

PHP is a pragmatic language. It was created out of a specific need to be able to quickly make web pages (the name originally stood for Personal Home Pages) and the language was extended as required. Since there was no theoretical background or strong design principles driving its creation (there isn't even a formal specification of the language) it is less clean than many other more modern languages. Features like correct handling of foreign characters / unicode characters are obviously added on afterwards and not cleanly integrated with the rest of the language. This untidiness and lack of theoretical rigour causes many people (especially academics) to dislike the language and this may be part of the reason why your teacher doesn't regard PHP as "real" language.

However PHP is good at what it was designed for and many sites use it, even very large sites like Facebook, Yahoo! and Wikipedia.

Mark Byers
Nice answer Mark! And I've just thought: `PHP == 'PHP: Hypertext Preprocessor' || PHP == 'Personal Homepage'` - ?!
Jack Webb-Heller
yes, I wrote that in codey-bits.
Jack Webb-Heller
@Jac Webb-Heller: The name originally was an abbreviation for 'personal home page' but later changed as PHP evolved.
Mark Byers
Right, thanks for clarifying!
Jack Webb-Heller
From http://www.php.net/manual/en/history.php.php : PHP/FI stood for "Personal Home Page / Forms Interpreter"
luiscubal
+14  A: 

define:programming language

It seems, according to this, that PHP is a programming language. Whether it's a real programming language is entirely subjective. Whether it's a good language is also subjective. Certainly, it is most commonly not used as an application programming language, but it can be used to develop shell applications via CLI. I have never done this, so my understanding of it is sketchy, but it's possible.

Now, is PHP "scripted" (I take this to mean a scripting language), and does it run on every platform? You judge:

PHP: Hypertext Preprocessor is a widely used, general-purpose scripting language that was originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document. As a general-purpose programming language, PHP code is processed by an interpreter application in command-line mode performing desired operating system operations and producing program output on its standard output channel. It may also function as a graphical application. PHP is available as a processor for most modern web servers and as standalone interpreter on most operating systems and computing platforms.

Source: http://en.wikipedia.org/wiki/PHP

Does Java even run on every platform? No. Only those for which there exists a JVM.

Finally, does a language need to be compiled? Many aren't. Even Java isn't compiled in the same way C or C++ is. And then you'd also need to take a look at Perl, Python, etc.

Personally, I think PHP is a real programming language. I started there and easily moved on to C/C++ and Java. I wouldn't use it for the same purpose as Java, and its design is different from Java, but that doesn't mean much. It was easier to learn than Java for me.

TNi
Great, thorough answer TNi! Thanks!
Jack Webb-Heller
+3  A: 

Back when I was learning PHP, I too didn't believe PHP to be a programming language.

I'm not sure where I picked the idea up, but I learned somewhere that a scripting language is not a programming language. So I applied this thinking to other languages, such as JavaScript and SQL.

Since then I have changed my mind and understand now that there is a spectrum of languages that goes from high level (e.g. PHP, Javascript) to low level (e.g. c, assembler) with things like C# and Java somewhere in between.

Matt Ellen
+3  A: 

You are right. These reasons are too weak. Actually you don't even need Apache to run PHP.
And first two reasons are just repeat themselves as it's only one reason actually. So, one can say 'PHP is not compiled language' but that doesn't mean it's 'not real programming language'. Java programs doesn't compile into machine codes too - well, it's not a real language as well. q.e.d.

Col. Shrapnel
+16  A: 

It's not compiled

It can be.

It's scripted

Ah! The cunning technique of repeating an argument after rephrasing it to make it sound like a different argument.

It doesn't run on every platform

Nor does Java.

Sounds like you have a really bad teacher there.

David Dorward
PHP to optimized C++! What will they think of next?
TNi
Yes, the teacher is trying to justify his own ignorance by claiming what he doesn't know isn't worth knowing.
Bill Karwin
It's easy to find fault in someone who you don't agree with. _The cunning technique of trying to make someone sound dumb so nobody will take their argument seriously but throw it out without thinking._
John
@John: But what he sais is correct. The teacher was wrong in all points, which are listed above.
nikic
@John: What exactly are you complaining about? That David found mistakes in the teacher’s arguments? Whether or not he agrees is completely irrelevant.
Konrad Rudolph
A: 

Its just one of those stupid things people repeat to make themselves sound smarter and shut you ups, its cargo cult smugness. If you ask him to explain, he'll either pretend it was a joke(tell him "nice try"), or try pathetically to defend his position (tell him "oh i see", and back away slowly)

asdfjkl
A: 

Just to put an argument in the other direction to everyone else...

I feel slightly uncomfortable thinking of PHP as a programming language because I'm not convinced you end up with a program. You don't leave your PHP app running, rather a PHP page is requested and is loaded and processed in order to generate an output page, with side-effects like DB changes, etc.

None of this means PHP can't technically be described as a programming language but I think it's reasonable to separate it somehow from Java/C++ where a program can be left running with some concept of state. Each PHP file is surely its own 'program' since you can request any PHP page... there's no entrypoint to a PHP web-application except the convention of calling the right pages.

John
Cmon, there's php-cli !What's exactly is preventing you from having an infinite while(true) {} in a PHP file that, for example, check a mysql table to be externally filled by email adresses and send emails to the adresses as soon as they appear in the table ?Then you'd have to start this php "process" in CLI and watch it process emails forever.That's an implementation of a "deamon" in php.The guys who really studied PHP would argue that the real problem in PHP in memory leaks when you use Objects.The real php experts would respond that, since php 5.3, those memory leaks are gone.
bPizzi
There are couple examples to counter that idea. There are for example PHP-GTK applications, like text editors: Tulip http://tulip.solis.coop.br/us/install_lin.php, or servers which run for quite a while: http://nanoweb.si.kz/
mario
I have written completely “normal” command line applications in PHP. You’re confounding PHP programming with web programming. Your argument basically says that a web application is different from a client-side application but that’s saying nothing about the *language* used to produce either. By the way, I think PHP is a *really* horrible language. But there’s no arguing that it’s a *real* language.
Konrad Rudolph
+10  A: 

Of course php is a programming language. He probably meant it isn't a "real" programming language in the same sense that "real" men don't eat quiche.

Dipstick
I laughed out loud at this one!
Jack Webb-Heller
This might be some kind of coming out but... I like quiche. I felt I had to say it.
DrDro
This is the only answer that didnt confuse "real" with it's literal meaning...
Inverse
A: 

UPDATE: read carefully before you vote, this is not my approach to PHP/Java, I'm trying to see how his teacher sees the PHP/Java thing. Thanks.

What I think your teacher thought: PHP is a language which is locked inside a webserver, mostly used to generate web pages.

Java, on the other hand, is a general-purpose language used for web pages too but used in other industries like microwaves & cars, you can write desktop application in Java etc.

With this in mind it's understandable why your teached said "PHP isn't a real programming language!"

I'm not biased, I don't like both, Java & PHP :) ...but have to use them both

dwich
PHP is not locked inside a webserver. http://php.net/manual/en/features.commandline.php // http://gtk.php.net/
David Dorward
David, I know about it, of course, I do PHP every day for 10 years. How many projects are done in PHP in command line? I was trying to reflect how his teacher sees the PHP vs Java thing.
dwich
A: 

"So, in the 'definition of a programming language', what makes PHP not a 'proper' one?"

The real reason is the fact that most people do not use it as a general purpose application programming language.

It is because there have been always languages which are better suited (with one exception: what PHP was created for, web programming). PHP is "yet another language not even with better design features over existing ones". Some examples of issues when comparing to different other languages include: lack of stable and portable GUI toolkits (at least on Windows/MacOS), lack of threading, lack of speed, and so on.

Ultimately, people who are going to write general applications in PHP, are mostly people who only know well PHP as a programming language. Because there is no reason to write a new application from scratch in PHP: you'll find that most experimented or talented programmers would never consider doing this.

Cerpheus
A: 

Certainly, PHP is a programming language. It is even Turing-complete language, which basically means that its "power" is equal to "power" of other programming languages. It is "real" both in strict (it really exists) and metaphorical sense (there are people making their living using PHP). So it seems that your teacher is somehow biased.

However, I see some point in your teacher attitude. PHP and Java come from radically different backgrounds. Despite being useful, PHP is very chaotic. Compare standard class library in Java with standard library of PHP functions - the latter looks just like huge set of unrelated tools. Moreover, there are a lot of PHP tutorials on the Web that are of, politely speaking, mediocre quality. Because you are learning how to program, it's best to learn using good tools, and Java is much better tool to learn programming than PHP.

PS. Google for "PHP sucks" to get tons of information why PHP isn't the best tool in the world.

el.pescado
+2  A: 

Facebook, Digg, Wikipedia, Yahoo. I guess those aren't real websites.

Daniel
+5  A: 
Roger Pate
Wow. Amazing answer! This 'bikeshedding' concept is a great way of explaining it.
Jack Webb-Heller
A: 

There is no such thing as a real programming language, real man, or real world. You are a programmer if you can program in PHP.

BobTurbo
That could just make one a day coder. You're a programmer if you think in terms of loops, conditionals, data structures, etc., regardless of the programming language.
George Marian
+1  A: 

Sorry for the OT, but there are so, so many things wrong with this picture! I just hope that you will bail out of that class, that department, and that school just as quickly as you can. I promise that you'll have nothing near to a semester's worth of knowledge when February comes. And, if you're like me, you'll spend your classroom hours in frustration, resentment, and rage at the time your teacher is wasting for you.

That woman is no teacher! Decimal to binary as an intro to coding? Gruesome!

Is it the University (ha!) of Phoenix?

Pete Wilson