Skip to content

Home

nikic edited this page Sep 13, 2010 · 19 revisions

What is prephp for?

prephp allows one to use custom syntax for PHP. Especially prephp implements PHP 5.3 syntax for PHP 5.2. (Or at least, it will be implemented.)

What syntax does prephp implement at the moment?

  • simulating a “normal” PHP environment for scripts precomiled by PHP. (For example, changing __LINE__, __FILE__, a.s.o.)
  • 5.3: simulating __DIR__
  • 5.3: simulating Lambda Functions and Closures (function($some, &$args) {} and function($some, &$args) use($some, &$vars) {}
  • 5.3: Referencing the class for the Scope Resolution Operator using a variable ($classname::)
  • 5.3: const keyword outside classes
  • 5.3: Ternary operator without middle part (?:)
  • 5.4: array dereferencing (call_a_func($some, $args)[$arrIndex])
  • call function return values [not part of PHP yet] (func($some)($args))

Planned features

  • 5.3: Namespaces [work ongoing: basic implementation landed]
  • 5.3: Late Static Binding (static::)
  • 5.3: NOWDOC (<<<'END_TOKEN' ... END_TOKEN)
  • 5.3: __callStatic() Magic Method
  • 5.3: __invoke() Magic Method

  • 5.4: Function argument typehints for scalars
  • 5.4: Traits

Not planned features

  • goto (Highly complex and inefficient to implement and rarely used)
Something went wrong with that request. Please try again.