3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class User { public const STATUS_ACTIVE = 'active'; public const STATUS_INACTIVE = 'inactive'; public static $nombreUtilisateursInitialisés = 0; public function __construct(public string $username, public string $status = self::STATUS_ACTIVE) { } } class Admin extends User { public static $nombreAdminInitialisés = 0; public static function nouvelleInitialisation() { self::$nombreAdminInitialisés++; parent::$nombreUtilisateursInitialisés++; } } Admin::nouvelleInitialisation(); var_dump(Admin::$nombreAdminInitialisés, Admin::$nombreUtilisateursInitialisés, User::$nombreUtilisateursInitialisés); var_dump(User::$nombreAdminInitialisés); // ceci ne marche pas.
Output for git.master, git.master_jit, rfc.property-hooks
int(1) int(1) int(1) Fatal error: Uncaught Error: Access to undeclared static property User::$nombreAdminInitialisés in /in/g4tlE:32 Stack trace: #0 {main} thrown in /in/g4tlE on line 32
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
55.38 ms | 405 KiB | 5 Q