https://github.com/nikic/php-backporter
Converts PHP 5.3 code to PHP 5.2 code
https://github.com/nikic/php-backporter
Last synced: 3 months ago
JSON representation
Converts PHP 5.3 code to PHP 5.2 code
- Host: GitHub
- URL: https://github.com/nikic/php-backporter
- Owner: nikic
- Created: 2011-08-05T13:34:46.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-09-04T09:34:24.000Z (over 14 years ago)
- Last Synced: 2025-03-25T07:51:14.956Z (10 months ago)
- Language: PHP
- Homepage:
- Size: 115 KB
- Stars: 22
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PHP Backporter
==============
Currently supported
-------------------
* `const` statements (converted into `define` function calls)
* `__DIR__` magic constant (converted into `dirname(__FILE__)`)
* Lambda functions (converted into normal functions)
* Closures (converted into classes)
* Namespaces (converted into underscore-separated pseudo namespaces)
Limitations
-----------
### Closures ###
Closures are represented by a callable array, so calls of type $function() will be transformed
into call_user_func(_array) calls. This can be a problem is functions expect arguments by reference.
### Namespaces ###
The current namespaces implementation is very limited. Most notably it assumes all unqualified uses
of constants and functions are global if a global constant with such a name is defined and local if
it is not. Additionally many dynamic constructs do not work yet.
ToDo
----
* Dynamic scope resolution (`$className::`)
* Short ternary operator
* Late static binding (?)
* `__callStatic` magic (?)
* `__invoke` magic (?)
* `goto` (?)
* ...