Scriptorama.nl

Header image showing a keyboard, mouse, laptop and books on design patterns

Microsoft brengt PHP naar .NET

Software gigant Microsoft gaat PHP naar het .NET platform brengen. Binnenkort zullen zij Phalanger uitbrengen, een PHP compiler voor het .NET platform. Normaal worden PHP scripts geinterpreteerd door Zend Engine, waarbij PHP code wordt omgezet in opcodes. Bij het compilen van PHP scripts wordt de code eenmalig omgezet in uitvoerbare code. Elke keer dat het script wordt aangeroepen, wordt de uitvoerbare code onmiddelijk uitgevoerd. Dit betekent dat er een snelheid winst te halen valt, want er komt geen interpreter van pas.

Hieronder staan enkele extra mogelijkheden die deze integratie met zich meebrengt.

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 namespace N { ... }
  • Access classes and functions in namespaces using new N:::C; N:::C::f(); N:::C::$x;
  • Import namespaces to scripts using import namespace System:::Collections:::Generics;
  • Declare generic classes and functions using class< :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) { ... }

Met Phalanger kan je dus PHP en .NET combineren. PHP ontwikkelaars kunnen dus ASP.NET web applicaties ontwikkelen met hun favoriete taal!

Reageer ook!

Uhm, Phalanger is niet van Microsoft zelf. CodePlex, de site waar je naar linkt, is van Microsoft:

"CodePlex is Microsoft's community development Web site. You can use CodePlex to create new projects to share with your fellow developers around the world, join others who have already started their own projects, or use the applications on this site and provide feedback."

Phalanger is een onafhankelijk project.

My bad, je hebt gelijk.

microsoft met zn inhaalrace.. ze moeten die machine eens olieen

Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>