PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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.
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).
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.
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.
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