Compatibility With Zend PHP
This page discusses compatibility issues between Roadsend PHP and Zend PHP.
Command Line Options
As of version 2.9.0, Roadsend PHP will parse Zend PHP compatible command line options if the binary is run as "php". You can do this by renaming "pcc" to "php" or by symlinking it, for example.
Versions
As of version 2.9.3, PHP 4 semantics are deprecated, and PHP 5 (ZendEngine? 2) syntax and object semantics are supported.
- PHP5
- WORKING in latest source version (2.9.x):
- __construct()
- __destruct()
- __toString()
- static class members
- expressions inside of strings, as in: "{$foo->method(print 'foo')}"
- PHP5 style object assignment semantics
- method calls on return values: $foo->method()->method()
- property visibility: public, private, protected
- exceptions
- class constants
- object cloning (with call to __clone())
- static methods
- object autoloading through __autoload()
- instanceof operator
- final methods
- abstract classes
- interfaces
- method visibility: public, private, protected
- type hinting
- final class
- overloading with __get(), __set(), __call(), __isset(), __unset()
- built in interfaces: ArrayAccess?, Traversable, Iterator, IteratorAggregate?, Serializable
- iteration of objects that implement Iterator or IteratorAggregate?
- offset access to objects by implementing ArrayAccess? interface
- NOT yet working:
- class reflection
- full SPL implementation (FilterIterator?, etc)
- WORKING in latest source version (2.9.x):
Language Notes
- Destructors work differently in Roadsend PHP because the memory manager uses garbage collection rather than reference counting. Destructors are run when the object is collected, which is not necessarily right when the object is no longer reachable through PHP code. This means they often fire later than expected with Zend PHP.
Runtime Differences
- You can't depend on the directory part of the __FILE__ constant in compiled apps. That's because the real file no longer exists, as the file has been compiled into a library or binary. For compiled applications, __FILE__ will return the script relative to the compile root directory. It functions as per Zend in the interpreter, however. Example:
$ cat t1.php
<?
include('./foo/t2.php');
echo "in t1 i am ".__FILE__."\n";
?>
$ cat foo/t2.php
<?
echo "in t2 i am ".__FILE__."\n";
?>
$ pcc -f t1.php
in t2 i am /home/user/php/foo/t2.php
in t1 i am /home/user/php/t1.php
$ pcc t1.php
$ ./t1
in t2 i am foo/t2.php
in t1 i am t1.php
Extensions
- Standard
- XML
- MySQL
- PHP-GTK
- Sqlite
- The OO interface is not implemented, only the procedural functions are implemented (but, see PDO)
- Curl
- ODBC
- pcc-win
- pcre
- sockets
- PDO
- As of 2.9.3, PDO support is offered for MySQL and Sqlite only
