3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $scan = "00:12:a9:54:f6:a7,Privacy,-52.00,3Com,6,30:91:8f:24:07:d0,RSN: Privacy,-85.00,CenturyLink3873,1,00:0c:e5:46:2d:74,ShortSlotTime,-92.00,WLAN,1,c0:3f:0e:57:87:e8,RSN: Privacy,-94.00,Megan-PC-Wireless,6,00:12:a9:54:f6:a7,ShortPreamble,-45.00,WLAN,7"; $escan = (explode(",",$scan)); $cscan = (array_chunk($escan, 5)); class d_object { private $mac; function __construct ($payload) { if (is_array($payload)) $this->from_array($payload); $this->color = $mac; } public function from_array($array) { foreach(get_object_vars($this) as $attrName => $attrValue) $this->{$attrName} = $array[$attrName]; } public function s_output () { print "{$this->$mac}"; } } $device = new d_object($cscan); $device->s_output(); ?>
based on Sv58f
Output for 7.1.0 - 7.2.0
Notice: Undefined index: mac in /in/gePXe on line 23 Notice: Undefined variable: mac in /in/gePXe on line 16 Notice: Undefined variable: mac in /in/gePXe on line 28 Notice: Undefined property: d_object::$ in /in/gePXe on line 28
Output for 7.0.0 - 7.0.20
Notice: Undefined index: mac in /in/gePXe on line 23 Notice: Undefined variable: mac in /in/gePXe on line 16 Notice: Undefined variable: mac in /in/gePXe on line 28 Fatal error: Uncaught Error: Cannot access empty property in /in/gePXe:28 Stack trace: #0 /in/gePXe(33): d_object->s_output() #1 {main} thrown in /in/gePXe on line 28
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Notice: Undefined index: mac in /in/gePXe on line 23 Notice: Undefined variable: mac in /in/gePXe on line 16 Notice: Undefined variable: mac in /in/gePXe on line 28 Fatal error: Cannot access empty property in /in/gePXe on line 28
Process exited with code 255.
Output for 5.0.5 - 5.2.17
Notice: Undefined index: mac in /in/gePXe on line 23 Notice: Undefined variable: mac in /in/gePXe on line 16 Notice: Undefined variable: mac in /in/gePXe on line 28 Fatal error: Cannot access empty property in /in/gePXe on line 28
Process exited with code 255.
Output for 5.0.4
Notice: Undefined index: mac in /in/gePXe on line 23 Notice: Undefined variable: mac in /in/gePXe on line 16 Notice: Undefined variable: mac in /in/gePXe on line 28 Notice: Undefined property: d_object::$ in /in/gePXe on line 28
Output for 5.0.3
Notice: Undefined index: mac in /in/gePXe on line 23 Notice: Undefined variable: mac in /in/gePXe on line 16 Notice: Undefined variable: mac in /in/gePXe on line 28 Notice: Undefined property: d_object::$ in /in/gePXe on line 28
Output for 5.0.0 - 5.0.2
Notice: Undefined variable: mac in /in/gePXe on line 16 Notice: Undefined variable: mac in /in/gePXe on line 28 Notice: Undefined property: d_object::$ in /in/gePXe on line 28
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/gePXe on line 10
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 T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/gePXe on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/gePXe on line 10
Process exited with code 255.