my friends says that php is compiled. I think it is just intercepted by the server and changed(rendered) into html and then your browser shows it to you. He thinks it compiles the source and the server runs the appilcation. Anyone know for sure?
Printable View
my friends says that php is compiled. I think it is just intercepted by the server and changed(rendered) into html and then your browser shows it to you. He thinks it compiles the source and the server runs the appilcation. Anyone know for sure?
PHP is a scripting language, however, there are compilers which can take a PHP script and turn it into a program.
Also, wrong forum and you could have confirmed this in .00000003547 seconds with google.
google really isnt giving me a straight answer. thanks for yours though.
http://www.google.com/search?q=defin...utf-8&oe=utf-8Quote:
Originally posted by BrandonTurner
google really isnt giving me a straight answer. thanks for yours though.
Very first definition on the very first line "scripting language".
yeah, i did that afterwards to prove it to him. As a side note... are you from genmay?Quote:
Originally posted by kasracer
http://www.google.com/search?q=defin...utf-8&oe=utf-8
Very first definition on the very first line "scripting language".
allnighte
I was from Genmay until M|22 paid for my SA membership and I haven't looked back since.Quote:
Originally posted by BrandonTurner
yeah, i did that afterwards to prove it to him. As a side note... are you from genmay?
allnighte
ahhh. why did he pay for the SA account, you like being a Goon?
He paid for it because I was whinning about how the Admins were retards who couldn't do their job correctly and fairly. Sanjay responded by changing my name about 4 different times in 1 thread before M|22 bought me my SA membership and premium and then banned me.Quote:
Originally posted by BrandonTurner
ahhh. why did he pay for the SA account, you like being a Goon?
Being a Goon is awesome.
Aren't ALL languages compiled in one way or another? Even an interpreted language is changed/compiled so your computer can read it. It has to be turned into 1's and 0's otherwise your processor will spit it out. Where compiled into an executable or processed on the fly every language is compiled.
BTW, I am a professional PHP developer.
No. Scripting languages != CompiledQuote:
Originally posted by Arc
Aren't ALL languages compiled in one way or another?
.NET?Quote:
Originally posted by Spetnik
Some scripting languages are compiled at runtime. I don't know which, offhand, but I do know that some are.
A language can not be proccesed by a computer unless it has been compiled. Therefore PHP = compiled.
How did you come to that conclusion?Quote:
Originally posted by Arc
A language can not be proccesed by a computer unless it has been compiled. Therefore PHP = compiled.
A compiled language is one which is run by being compiled into machine code. An interpreted language is one which is interpreted by a precompiled binary.
Yes - PHP has to be translated into machine code but this is done by a separate program. Where as a compiled program written in C would be able to run standalone.
PHP is not compiled in a sense that ASP .NET is. In fact there is a commercial solution available from Zend that tries to mimic compilation called Zend Accelerator.
BrandonTurner: Don't get into the argument of proving PHP is better or ASP or ASP .NET. It's just a headache, and almost always accompanied by prejudice.
I thought you were a professional PHP developer?Quote:
Originally posted by Arc
A language can not be proccesed by a computer unless it has been compiled. Therefore PHP = compiled.
That's just...... badQuote:
Originally posted by Spetnik
I know many professional developers who have not a clue as to how languages work.
I think if you're using a language, you should know how it works.Quote:
Originally posted by Spetnik
Why is that? They are good programmers, have jobs, and make money. What more do they need?
There are indeed scripting languages that get compiled. E.g. the Rhino JavaScript engine, which is written in Java, can compile JavaScript to Java bytecode.
JavaScript isn't compiled by default, you have to use a 3rd party tool to do it. The same is with PHP (which I mentioned earlier). Some people actually develop applications in PHP. A scripting language, by deifnition, isn't compiled. Doesn't mean someone can't come along and make a compiler for it though.Quote:
Originally posted by CornedBee
There are indeed scripting languages that get compiled. E.g. the Rhino JavaScript engine, which is written in Java, can compile JavaScript to Java bytecode.
To better themselves? If you're a professional PHP developer but don't know how PHP works, that is pretty bad and they better hope no one finds out.Quote:
Originally posted by Spetnik
You did not answer my question. Why would they need to know how it works if they are doing perfectly fine without it?
They could be doing better than just "perfectly fine" if they knew how the language works under the hood. I see it all the time with my brother. He hasn't got a clue about programming language fundamentals (don't confuse it with programming fundamentals), and thus his code could be far more efficient.
By default?Quote:
Originally posted by kasracer
JavaScript isn't compiled by default, you have to use a 3rd party tool to do it.
That really leads only to a discussion about the definition of a scripting language. For example, emacs uses scripts written in a scripting language - but they always get compiled to some intermediate form.
Does that make it not a scripting language?
I highly doubt they're producing 'quality code'Quote:
Originally posted by Spetnik
I am not saying that knowing how a language does not help. All I am saying is that there are many professional programmers out there who do not know exactly how the technology works, yet they produce quality code, and are making large salaries, and therefore, they have no immediate need to learn what goes on at the low-level of their systems. That's all:).
Then it wouldn't be a scripting language. Google's definitions are NEVER WRONG!Quote:
Originally posted by CornedBee
By default?
That really leads only to a discussion about the definition of a scripting language. For example, emacs uses scripts written in a scripting language - but they always get compiled to some intermediate form.
Does that make it not a scripting language?
Quote:
scripting language - A scripting language differentiates itself from other typical languages in that they are usually simpler to learn and use as well as not needing to be compiled. The language is interpreted at run-time so you can execuate instructions immediately.
Scripting Language != Script but those definitions don't disprove what I said.Quote:
one of the thing i thought about to logically prove my point was the fact that there is such a thing as PHP injection exploits. If it was compiled putting code into the program would just mess up the program not cause it to do what you put into it. Then my friend said that it is possible to have injection becuase it is compiled line by line as it goes during run time which sounded reasonable i guess.
You are right about that.Quote:
Originally posted by Spetnik
I am not saying that knowing how a language does not help. All I am saying is that there are many professional programmers out there who do not know exactly how the technology works, yet they produce quality code, and are making large salaries, and therefore, they have no immediate need to learn what goes on at the low-level of their systems. That's all:).
My very nature is to question things and that is the only reason I know how VB programs and C programs are compiled and it does give you an upper hand beucase sooner or later there will be an error in the compiling or linking of a program and you're screwed if you have never seen that kind of error before.
No, you're getting the program to jump from the interpreter's code to the malicious injected code.Quote:
Originally posted by BrandonTurner
one of the thing i thought about to logically prove my point was the fact that there is such a thing as PHP injection exploits. If it was compiled putting code into the program would just mess up the program not cause it to do what you put into it. Then my friend said that it is possible to have injection becuase it is compiled line by line as it goes during run time which sounded reasonable i guess.
Compiling line by line as you go through a program is horribly inefficient - compiling a line takes longer than interpreting it.
I never said PHP could be compiled into a stand alone app. I was merely making the point that all languages must be turned into machine code at some point in order for the processor to understand waht it means. A processor can not read any language, be it a stand alone compiled exe or a scripted php page. They all must be turned into machine code in order for them to be usable and isn't that exactly what compilation does?
I was using the definition of compilation which basically means "Change to machine code" and if you look at it like that then yes all languages must be compiled. Therefore , in a sense, all languages are compiled languages.
If you look here you will see that the Computer Science definition for Compile is To translate (a program) into machine language.
:D
Its more than just translating the source code into machine code.
If you did that then your program wouldn't work.:)
No, arc, not all languages must be compiled. Interpretation means to invoke already existing machine code bits according to a text pattern. This is not compilation, where machine code is created according to a text pattern.
Unless any of you have built a compiler, I guess you are disguising intelligence on the matter behind what you have read in a book, or on the web.
Look at Java for instance... it's a supposed write-once run-everywhere platform. That's all fine for the programmer, but not the guy that has to create a compiler for that bytecode for each processor platform on the market.
...but i bet your brother has got:Quote:
Originally posted by CornedBee
They could be doing better than just "perfectly fine" if they knew how the language works under the hood. I see it all the time with my brother. He hasn't got a clue about programming language fundamentals (don't confuse it with programming fundamentals), and thus his code could be far more efficient.
> a girlfriend and/or a healthy interest in the opposite sex
> a social life
> assorted interests OUTSIDE of work/computing
> a glowing complexion
;) ;) ;)
...sorry couldn't resist :wave:
I'm not disguising anything. What I talk about here is indeed mainly what I've learned from books or the web. But no matter the source of my knowledge, I have this knowledge, unlike some other people here.Quote:
Originally posted by nemaroller
Unless any of you have built a compiler, I guess you are disguising intelligence on the matter behind what you have read in a book, or on the web.
Look at Java for instance... it's a supposed write-once run-everywhere platform. That's all fine for the programmer, but not the guy that has to create a compiler for that bytecode for each processor platform on the market.
And what has your Java example to do with it? This guy gets paid by Sun for what he does.
powdir: I don't know what a glowing complexion is, but the others are all true ;)
Point of the JAVA example:
It distinguishes between the programmer (user), who knows nothing of what goes on under the hood, from the engineer (supplier), that wrote the code to convert it to machine language. You may read the white papers and comprehend how it works, but unless you wrote the code, you can't ever truly understand how it works.
In context of this debate of php being compiled... A person may know C++, ASM, JAVA, and/or PHP. And all those don't work unless compiled or interpreted into machine code for a specific processor.
The difference between compilation and interpretation is that interpretation doesn't translate to machine code, never.
"Interpreted to machine code" doesn't have a meaning.
Sure I can. I don't understand every detail, but I understand the process. And this is what we're talking about here. The question is not, "to what machine code is PHP compiled", but "is PHP compiled at all". Unless I wrote the PHP "compiler" (whatever), I couldn't answer the first question, but I can answer the second.Quote:
You may read the white papers and comprehend how it works, but unless you wrote the code, you can't ever truly understand how it works.
We already know what you ment and it is wrong. Sorry Mr. PHP Professional.Quote:
Originally posted by Arc
Randomly spouted stuff here
The final result is that that PHP script is eventually translated into MACHINE CODE! It has to be one way or another. Whether directly compiled or translated through a pre compiled parsing engine it is still translated into machine code.Quote:
Originally posted by Spetnik
Wrong. A scripting language is not translated into machine code, because it is not processed by the operating system directly. It is processed by the scripting engine, which is a precompiled application that performs tasks based on code written in the script. The same way that machine code is what the operating system understands, so too, the actual scripting code is what the scripting engine understands.
Why is this so hard to understand?
And as stated above the definition of compile is to translate into machine code. How it got translated is irrelevant.
But if you want to go by the normal consensus, then no PHP is not recognized as a "compiled" language, even though technically all languages are.
It's so hard to understand WRONG consepts. Just stop when you're beaten. PHP is not compiled, which you first said. You're slowly changing your wording to try and make it look like you're right.Quote:
Originally posted by Arc
The final result is that that PHP script is eventually translated into MACHINE CODE! It has to be one way or another. Whether directly compiled or translated through a pre compiled parsing engine it is still translated into machine code.
Why is this so hard to understand?
This is the dumbest, most ignorant comment I've ever seen on a forum.Quote:
Originally posted by Arc
But if you want to go by the normal consensus, then no PHP is not recognized as a "compiled" language, even though technically all languages are.
If I were you, I'd just delete that post and make like nothing ever happened, seriously......
Slow down kas.
Arc, you seem to have a wrong concept of what "compiled" means. I'm strongly considering writing a tiny scripting language to show you where you are wrong, but I'm pretty busy.