Page 2 of 2

Posted: Wed Jul 11, 2007 6:24 pm
by stereofrog
No, php is not an interpreted language in a strict sense. Php engine first compiles entire file into bytecodes, and than executes the bytecode stream. That is, there is a strict separation between compile- and run time in php, just like in C.

Posted: Wed Jul 11, 2007 6:33 pm
by Behzad
I never knew this.
So why we can't publish the byte-codes like Java and run them under a PVM (PHP Virtual Machine)?
Isn't this faster? (I'm asking because you've implemented pihipi).

Posted: Wed Jul 11, 2007 6:43 pm
by Ollie Saunders
APC is an existing project that takes advantage of PHP's bytecoded nature. There are already at least two projects under-way to write additional PHP virtual machines both of them new at least one of them sponsored by IBM.

Posted: Wed Jul 11, 2007 7:45 pm
by Christopher
Behzad wrote:What's wrong with $product = new Product($productCode) ?
Nothing. My general response to your question is that you should always an instantiated object until you find a problem where you simply cannot solve it without using a static.
stereofrog wrote:The problem is, what should "new User($id)" return when no such user exists?
Either a User record that contains no data (and is in a error state) or and exception.

Posted: Thu Jul 12, 2007 7:09 am
by Behzad
Well, it sounds everyone has an idea and I'm a little confused.
I'm going see some sample codes online. Thanks every one.
However, I still rather to use static methods which returns an instance of the class :D