- Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
- Parse error: syntax error, unexpected '}' in /in/2XgBW on line 8
Process exited with code 255.
<?php
class XML {
public function __CONSTRUCT($array) {
foreach($array as $key => $val) {
if(isset($key) && $key) {
$this->$key;
bindTo($this->$key, $this->$val)
}
else {
bindTo($this->$val, $this->$val);
}
}
}
}
$array = ["database"=>["host"=>"localhost","dbname"=>"mydb","user"=>"root","password"=>""]];
$xml = new XML($array);
echo($xml->{"database"}->{"host"});