Skip to content

Magic methods not working as expected #1108

@luizzaiats

Description

@luizzaiats

On PHP, we can instantiate a stdClass and set properties dynamically as follow:

$obj = new stdClass(); $obj->name = 'My Name'; $obj->time = time();

On PeachPie is there a way to do that? I've tried:

dynamic _obj = new stdClass(); _obj.name = "My Name";

But I got the following error:

Unhandled exception. Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Pchp.Core.PhpValue' does not contain a definition for 'name'

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions