This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findProperties(elem) { | |
let result = []; | |
for(let prop in elem) { | |
if(elem.hasOwnProperty(prop)) { | |
result.push(prop); | |
} | |
} | |
return result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Dynamique { | |
private array $dynamic = []; | |
public function __set(string $name, mixed $value) { | |
echo "set $name to $value\n"; | |
if(property_exists($this, $name)) { | |
$this->{$name} = $value; | |
} else { | |
$this->dynamic[$name] = $value; |