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.
I'm with you arc!
All programming languages are script based. You use predefined verbs, nouns and other such constructors to create an instruction to the script parser to create machine executable code.
The difference between say C and PHP is that the C code is parsed before execution, whereas PHP is parsed during execution.
The C compiler and the PHP parser do exactly the same thing - that is they read the script and use blocks of predefined instructions (defined by the parser author) that perform the function described in the script.
If you want to called a pre-parsed script compiled and an 'on-the-fly' script interpreted fine, but this distinction does not change the fact that they are both "interpreted" at some point.
And yes, I have been involved in writing compilers.
That still strongly differs from any definition of interpretation and compilation I've ever heard Slaine.
Then post the definitions you have heard and we can look at the validity of them.
compilation/compile/compiled are meaningless word. Interpretation is the only thing that means something.
Also don't forget that not so long ago BASIC was parsed on-the-fly but now it is pre-parsed. That alone should show that the distinction is hazy.
Compilation: the process of creating binary code from source code.
Interpretation: the process of acting on the instructions of code in some form to produce immediate results.
So all languages get interpreted in some way (by the CPU, if not by anything else).
But only when a translation is done can you call it compiled.
PHP is never translated to some other form of code, the pre-existing machine code snippets are directly called, not pieced together to form compiled code.
The third definition is quite vague (what is computer-readable?), so I'll ignore it. But the second definition exactly matches what I mean. Compilation means that pieces of machine code are put together to form code. In interpretation, the pieces are not put together, they are called in succession, but always will the interpreter itself be there in-between.Quote:
compile
v 1: get together [syn: collect, accumulate, pile up, amass, hoard] 2: put together out of existing material; "compile a list" [syn: compose] 3: use a computer program to translate source code written in a particular programming language into computer-readable machine code that can be executed
For the time being let us ignore any optimistation that may take place during any kind of interpretation/compilation. I am also not denying that pre-processed code is different to code processed on the fly.
Ultimately I think the argument here is about semantics - there are no "set in stone" definitions for compile, intepret, script and scripting.
Regardless of that if you think about what happens during the process of (your definition) of compile and (your definition) of intepretation you will see that the same thing is happening.
A utility takes a list of instructions, looks up the instuctions in a table. The table holds details of what machine code is required to complete that instruction.
What happens to the machine code is where the distinction lies - in a "compiled" language the utility writes then to a file, in an "interpreted" language the utility sends them to the CPU to be run immediately. But ultimately the instructions have gone through the same process.
Now if we introduce optimisation - then the compiler, because it is able to analyse the instructions in their entirety, prior to execution, is more able to take decisions on what would be more efficient based on how the code works as a whole.
And what is the difference between the interpreter being in-between and the compiler being in-between?Quote:
Originally posted by CornedBee
The third definition is quite vague (what is computer-readable?), so I'll ignore it. But the second definition exactly matches what I mean. Compilation means that pieces of machine code are put together to form code. In interpretation, the pieces are not put together, they are called in succession, but always will the interpreter itself be there in-between.
Is Slaine Arc's twin brother or something? Jeeze, you two have alot of reading to do.
He deserved it, coming into a thread making ignorant comments about PHP and then saying he was a PHP Professional.Quote:
Originally posted by CornedBee
Slow down kas.
Come on, that is just asking for a flame.
It seems to me kasracer you're only contribution to the discusion is to bandy insults and put downs. Is this to disguise your lack of knowledge on the subject, or are you just incapable of reasoned debate.Quote:
Originally posted by kasracer
Is Slaine Arc's twin brother or something? Jeeze, you two have alot of reading to do.
He deserved it, coming into a thread making ignorant comments about PHP and then saying he was a PHP Professional.
Come on, that is just asking for a flame.
Don't waste your time answering me cause you are now on my ignore list.
I've been in plenty of debates, but come on now. What you two are arguing for isn't even remotely true and is just plain stupid. There is no point. That and this is chit chat, if you actually wanted a debate on something, you wouldn't post it here because all I do here is bull****, as well as most people.Quote:
Originally posted by Slaine
It seems to me kasracer you're only contribution to the discusion is to bandy insults and put downs. Is this to disguise your lack of knowledge on the subject, or are you just incapable of reasoned debate.
Congradulations, you can't take an insult from someone on the internet and put them on your ignore list. Grow some thicker skin, wuss.Quote:
Originally posted by Slaine
Don't waste your time answering me cause you are now on my ignore list.
In my opinion you are taking this debate too seriously kasracer. All you are doing is replying to posts and saying they are wrong and not backing up your reasons:confused:
I think by now most readers of this thread have concluded that there is a fine line in how we define a compiled an interpreted language and their exact definitions.
At the end of the day even the CPU must interpret the machine code and carry out a predefined action based on the instruction given.
If you take Java as an example, it is compiled into intermediate code before being interpreted by a JVM on the clients machine.
Visual Basic executables use VB runtime libraries to convert a type of intermediate machine code into real machine code.
Both these beg the question - Compiled or Interpreted?
Interesting thread though I've learnt alot from reading it:wave:
Quote:
Originally posted by visualAd
All you are doing is replying to posts and saying they are wrong and not backing up your reasons
Does not compute. How exactly would that be serious?Quote:
Originally posted by visualAd
In my opinion you are taking this debate too seriously kasracer.
You Tell Me:)Quote:
Originally posted by kasracer
Does not compute. How exactly would that be serious?
None of this contradicts what I said.Quote:
Originally posted by Slaine
For the time being let us ignore any optimistation that may take place during any kind of interpretation/compilation. I am also not denying that pre-processed code is different to code processed on the fly.
Ultimately I think the argument here is about semantics - there are no "set in stone" definitions for compile, intepret, script and scripting.
Regardless of that if you think about what happens during the process of (your definition) of compile and (your definition) of intepretation you will see that the same thing is happening.
I know that essentially the same thing happens, and I acknowledged it in my last post (though not very obviously), but the difference is in the fine points of how and when it is done. You say pre-processed code is different to code processed on the fly, and this is what this debate is about. The former is compiled, the latter interpreted. And PHP is interpreted, the code is processed on the fly.
A file or some memory location - see JIT compiling.Quote:
A utility takes a list of instructions, looks up the instuctions in a table. The table holds details of what machine code is required to complete that instruction.
What happens to the machine code is where the distinction lies - in a "compiled" language the utility writes then to a file, in an "interpreted" language the utility sends them to the CPU to be run immediately. But ultimately the instructions have gone through the same process.
The interpreter is in-between on every execution, the compiler is in-between only during compile, never during execution.Quote:
And what is the difference between the interpreter being in-between and the compiler being in-between?