Danack / PHP-to-Javascript

A tool for converting simple PHP objects/code to Javascript, so that code for manipulating objects can be used both server-side and client-side.
Other
104 stars 32 forks source link

public field:critical #35

Closed ghost closed 11 years ago

ghost commented 11 years ago
class Person{
    public $skills = array();
    function __construct($skill){
        $this->skills[$skill]=true;
    }
}
$creativePerson = new Person('creativity');
$stupidPerson = new Person('stupidity');
//bad, will show "{"creativity":true,"stupidity":true}"
echo JSON::stringify(stupidPerson->skills);