3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Crear variable $Ryan y asignarle como valor la clase Usuario $Ryan = new Usuario(); // Ahora la variable Ryan es una clase, con variables $nombre y $edad $Ryan->AsignarNombre("Ryan"); $Ryan->AsignarEdad(19); //////////////////////////////////////////////// // Crear variable $Ismael y asignarle como valor la clase Usuario $Ismael = new Usuario(); // Ahora la variable Ismael es una clase, con variables $nombre y $edad $Ismael->AsignarNombre("Ismael"); $Ismael->AsignarEdad(21); ////////////////////// // Mostrar informacion de ryan $Ryan->MostrarDatos(); // Mostrar informacion de Ismael $Ismael->MostrarDatos(); Class Usuario{ public $nombre; public $edad; function AsignarNombre($nombre){ $this->nombre = $nombre; } function AsignarEdad($edad){ $this->edad = $edad; } function MostrarDatos(){ echo $this->nombre.' tiene '.$this->$edad.'\n'; } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $edad in /in/6Kbvr on line 44 Warning: Undefined property: Usuario::$ in /in/6Kbvr on line 44 Ryan tiene \n Warning: Undefined variable $edad in /in/6Kbvr on line 44 Warning: Undefined property: Usuario::$ in /in/6Kbvr on line 44 Ismael tiene \n

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:
44.43 ms | 401 KiB | 8 Q