Phalanger

1 program Added 2026-03-12T10:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: PHP .NET, PHP for .NET
Provenance: commit 087f710f7a · authored 2026-03-12T13:12:54+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

Clojure CLR (0.23)VB.NET (0.20)PascalABC.NET (0.15)Vulcan.NET (0.14)Planner (0.13)

LLM-contributed programs

Object-Oriented Animals

Provenance: commit 087f710f7a · authored 2026-03-12T13:12:54+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.php · license: Apache-2.0 · added: 2026-03-12T10:00:00Z
<?php
// Phalanger example - Object-oriented PHP compiled to .NET
// Demonstrates class inheritance and .NET interop

class Animal {
    protected $name;
    protected $sound;

    public function __construct($name, $sound) {
        $this->name = $name;
        $this->sound = $sound;
    }

    public function speak() {
        echo $this->name . ' says ' . $this->sound . PHP_EOL;
    }

    public function getName() {
        return $this->name;
    }
}

class Dog extends Animal {
    private $breed;

    public function __construct($name, $breed) {
        parent::__construct($name, 'Woof');
        $this->breed = $breed;
    }

    public function fetch($item) {
        echo $this->name . ' fetches the ' . $item . '!' . PHP_EOL;
    }

    public function describe() {
        echo $this->name . ' is a ' . $this->breed . ' dog.' . PHP_EOL;
    }
}

class Cat extends Animal {
    public function __construct($name) {
        parent::__construct($name, 'Meow');
    }

    public function purr() {
        echo $this->name . ' purrs contentedly.' . PHP_EOL;
    }
}

// Create instances
$dog = new Dog('Rex', 'German Shepherd');
$cat = new Cat('Whiskers');

// Demonstrate polymorphism
$animals = array($dog, $cat);
foreach ($animals as $animal) {
    $animal->speak();
}

// Dog-specific methods
$dog->describe();
$dog->fetch('ball');

// Cat-specific methods
$cat->purr();

// Using PHP_INT_MAX (a .NET platform constant in Phalanger)
echo 'Max integer: ' . PHP_INT_MAX . PHP_EOL;
echo 'Animal count: ' . count($animals) . PHP_EOL;

Contribute — propose a file extension

Tell us where to find evidence about Phalanger (mapped to pl/phalanger). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Phalanger/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← pH Phantom →