Pseudo-implementation of JavaScript for PHP 5

JavaScript for PHP (jsphp) is a pseudo-implementation of the ECMA 262 standard (JavaScript 8.5.1) for PHP 5.3+. It allows you to write code in PHP as if it were JavaScript, using the standard API and the dynamic attributes available in the language, such as prototype inheritence and chaining, first-class functions, and other object-orientated features. It includes JSBoolean, JSNumber, JSString, JSObject, JSArray, JSFunction, JSRegExp, JSDate, JSError and JSMath, as well as the global helper functions, such as parseInt or isNaN.

The syntax in jsphp is very similar to a native implementation, although adapted to the syntax of PHP. For example, the variables are prepended by a "$", the Object access opertaor is "->", and Strings are concatenated using a ".".

  $myString = new JSString( 'Hello World' );
  
  $myString = $myString->split( '' )->reverse()->join( '' );
  
  print( 'Reversed: ' . $myString ); // dlroW olleH

A short tutorial on using the implementation can be found here, while the technical documentation is available here.