3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Mammal { function mate(Mammal $with) { $thisClass = get_class($this); $withClass = get_class($with); $class = substr($thisClass, 0, -rand(1, strlen($thisClass) - 1)) . substr($withClass, rand(1, strlen($withClass) - 1)); eval("class $class extends Mammal {}"); return new $class; } } class Panda extends Mammal {} class Dolphin extends Mammal {} class Squirrel extends Mammal {} class Kangaroo extends Mammal {} $mingmong = new Panda; $charles = new Dolphin; $squidgy = new Squirrel; $wanger = new Kangaroo; $charlimong = $mingmong->mate($charles); $wangy = $wanger->mate($squidgy); $wangimong = $wanger->mate($charlimong); var_dump($wangimong);
based on oVFcu
Output for 5.3.2, 5.5.26, 5.6.8, 7.1.0
object(Khin)#7 (0) { }
Output for 5.0.1, 5.2.2, 5.4.5, 5.4.24, 7.0.14
object(Kanghin)#7 (0) { }
Output for 5.2.11, 5.3.1, 5.3.9, 5.3.18, 5.3.24, 5.6.17, 7.0.1, 7.0.6
object(Kangain)#7 (0) { }
Output for 5.5.30, 7.0.5
object(Kangarhin)#7 (0) { }
Output for 5.1.0, 5.2.5, 5.3.6, 5.4.10, 5.6.11, 7.0.0, 7.0.4
object(Kann)#7 (0) { }
Output for 5.5.28, 7.0.3
object(Kanhin)#7 (0) { }
Output for 5.1.6, 7.0.2
object(Kangphin)#7 (0) { }
Output for hhvm-3.12.0
object(Kanganin)#7 (0) { }
Output for 5.1.3, 5.3.22, hhvm-3.10.0
object(Kn)#7 (0) { }
Output for 5.6.28
object(Kananlphin)#7 (0) { }
Output for 5.4.11, 5.4.42, 5.6.21
object(Kangarohin)#7 (0) { }
Output for 5.6.20
object(Kangaran)#7 (0) { }
Output for 5.6.19
object(Kangarandhin)#7 (0) { }
Output for 5.2.17, 5.3.27, 5.6.14, 5.6.18
object(Kin)#7 (0) { }
Output for 5.6.16
object(Kangarodolphin)#7 (0) { }
Output for 5.1.4, 5.3.7, 5.3.11, 5.4.25, 5.4.34, 5.5.27, 5.6.15
object(Kan)#7 (0) { }
Output for 5.4.15, 5.4.29, 5.5.29, 5.5.34, 5.6.13
object(Kangaron)#7 (0) { }
Output for 5.3.20, 5.6.12
object(Kangarophin)#7 (0) { }
Output for 5.2.6, 5.2.16, 5.3.21, 5.3.28, 5.4.0, 5.4.30, 5.5.25, 5.6.10
object(Kanin)#7 (0) { }
Output for 5.0.3 - 5.0.4, 5.3.23, 5.4.27, 5.4.31 - 5.4.32, 5.4.40, 5.6.9
object(Kangan)#7 (0) { }
Output for 5.3.3, 5.5.35
object(Kangaandin)#7 (0) { }
Output for 5.3.17, 5.5.33
object(Kangarolphin)#7 (0) { }
Output for 5.2.12, 5.3.16, 5.4.12, 5.4.16, 5.4.39, 5.5.32
object(Kangn)#7 (0) { }
Output for 5.2.0, 5.3.4, 5.5.31
object(Kanlphin)#7 (0) { }
Output for 5.4.35, 5.5.24
object(Kaphin)#7 (0) { }
Output for 5.4.41, 5.4.45
object(Kangandin)#7 (0) { }
Output for 5.2.3, 5.4.44
object(Kangarnin)#7 (0) { }
Output for 5.4.9, 5.4.43
object(Kalphin)#7 (0) { }
Output for 5.2.4, 5.4.6, 5.4.17, 5.4.38
object(Kain)#7 (0) { }
Output for 5.4.37
object(Kangnolphin)#7 (0) { }
Output for 5.4.36
object(Kandn)#7 (0) { }
Output for 5.2.9, 5.4.28
object(Kangaroin)#7 (0) { }
Output for 5.4.26
object(Knin)#7 (0) { }
Output for 5.4.23
object(Kndolphin)#7 (0) { }
Output for 5.4.22
object(Kphin)#7 (0) { }
Output for 5.4.21
object(Kaann)#7 (0) { }
Output for 5.4.20
object(Kangaranhin)#7 (0) { }
Output for 5.2.7, 5.3.29, 5.4.19
object(Kangarn)#7 (0) { }
Output for 5.4.18
object(Kolphin)#7 (0) { }
Output for 5.4.14
object(Kangnin)#7 (0) { }
Output for 5.4.13
object(Kangaroandlphin)#7 (0) { }
Output for 5.4.8
object(Kangaanin)#7 (0) { }
Output for 5.4.7
object(Kadlphin)#7 (0) { }
Output for 5.3.10, 5.3.19, 5.4.2, 5.4.4
object(Kangahin)#7 (0) { }
Output for 5.3.15, 5.4.3
object(Kandhin)#7 (0) { }
Output for 5.4.1
object(Kangaraphin)#7 (0) { }
Output for 5.2.10, 5.3.26
object(Kangaroalphin)#7 (0) { }
Output for 5.3.25
object(Kangaroan)#7 (0) { }
Output for 5.3.14
object(Kangaandlphin)#7 (0) { }
Output for 5.3.13
object(Kangandolphin)#7 (0) { }
Output for 5.1.5, 5.3.12
object(Kangarphin)#7 (0) { }
Output for 5.3.0, 5.3.8
object(Kanphin)#7 (0) { }
Output for 5.3.5
object(Kangarann)#7 (0) { }
Output for 5.0.0, 5.2.15
object(Kangarin)#7 (0) { }
Output for 5.2.14
object(Kangaphin)#7 (0) { }
Output for 5.2.13
object(Kangalphin)#7 (0) { }
Output for 5.2.8
object(Kangarndhin)#7 (0) { }
Output for 5.2.1
object(Kangin)#7 (0) { }
Output for 5.1.2
object(Kahin)#7 (0) { }
Output for 5.1.1
object(Kangandhin)#7 (0) { }
Output for 5.0.5
object(Kangaroanin)#7 (0) { }
Output for 5.0.2
object(Kangaanphin)#7 (0) { }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting ')' in /in/JYhXp on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting ')' in /in/JYhXp on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/JYhXp on line 4
Process exited with code 255.