Frequently asked questions

Q: What is PHP?
PHP stands for PHP: Hypertext Preprocessor. It is a popular dynamic language used mainly for server-side web scripting. People usually use the PHP interpreter http://www.php.net/ to run their PHP code.

Q: Why would I want to compile PHP?
Obviously, compiled binaries are expected to run faster than interpreted source code. In addition, you may find it advantageous to be able to deploy your web application without source code.

Q: Why would I want to compile PHP to .NET?
For a number of reasons. Unlike the PHP interpreter, .NET provides a secure environment. No web server crashes, no buffer overruns. We generate verifiable .NET assemblies that easily interoperate with everything that runs on CLR. You get access to zillions of useful classes available to other .NET languages like C# or VB!

Q: And what about Mono? Does Phalanger version 2.0 work on this platform?
It does in general. However, there may be some issues due to Mono missing features or bugs.

Q: OK, but PHP is not just the language, it comes with a huge number of built-in functions.
We have reimplemented these built-in functions in .NET so you can still use them in Phalanger. We’ve put a great effort into keeping their semantics in sync with the originals.

Q: So can I take my existing PHP application and compile it in Phalanger?
Yes. Theoretically, you should be able to do this without changing a single line in your code.

Q: I would like to to try ASP.NET but C# scares me!
Don’t worry, with Phalanger you can write ASP.NET pages and use PHP as the code-behind language. There’s no need to learn C# or VB!

Q: I’ve been using Phalanger v1.0, what’s new in v2.0?
Phalanger v2.0 runs on .NET Framework 2.0 and finally supports full .NET interoperability. It means that you can directly use or extend any .NET class; be it System.Xml.XmlDocument, System.Windows.Forms.Form, or System.Web.UI.WebControls.DropDownList. We also support delegates, events, generics, and even some basic LINQ. You can still download the previous version.

Q: I’m a PHP guru, give me a rapid intro into the extensions to PHP language that you’ve made in order to interoperate with .NET.

  • Declare your classes and functions in namespaces using mespace N { ... }
  • Access classes and functions in namespaces using w N:::C; N:::C::f(); N:::C::$x;
  • Import namespaces to scripts using import namespace System:::Collections:::Generics;
  • Declare generic classes and functions using ass<:T:> { function<:S:> { } }
  • Instantiate generic classes using $d = new Dictionary<:string, string:>;
  • Invoke generic functions using System:::Array::ForEach<:int:>($array, $action);
  • Instantiate delegates using new EventHandler(”MyFunction”), new EventHandler(array(”MyClass”, “MyFunction”)), or new EventHandler(array($instance, “MyFunction”))
  • Apply custom attributes to classes, class members, or parameters using [ComVisible(false)] class C { ... }
  • Apply the [Exported] pseudo-custom attribute to classes or class members that you wish to expose to other .NET languages.
  • Use the partial modifier to declare a class that is split into multiple pieces.
  • When extending a CLR class without a parameterless constructor, invoke the base class constructor using function ___construct($x) : parent($x) { ... }

Q: Is this it? I want to know more!
Visit Documentation page.

faq.txt · Last modified: 2006/11/24 22:30
Phalanger