In php there is a complex (curly) syntax, it allows you to use complex expressions. Any scalar variable, an array element, or an object property can be represented in the string by this syntax. You just need to write an expression enclosing it in { and } .
This is most often used in strings. But it is also possible to do it without them.
As an example
class foo { var $bar = 'I am bar.'; } $foo = new foo(); $bar = 'bar'; $baz = array('foo', 'bar', 'baz', 'quux'); echo "{$foo->$bar}\n"; echo "{$foo->{$baz[1]}}\n";
Accordingly, if you do not want to convert your object into an array (which is also possible and not prohibited by the law), but you want to access the field of the object, then you can use this very figure syntax.
In your case it will be like this:
$res->{'validator-error'}
$res->{'validator-error'}- Alexey Shimansky