Special Characters in Property Name of Object

Special characters in property name of object

echo $myobject->{'%myproperty'};

Use special characters in object property name

by using variables variable as follows :

print_r($xml->{"reservation-details"});

consider the following example:

$ar = json_decode('{"var": "message", "var-1": "yello"}');
print_r($ar->{"var-1"});

Output : yello

live demo https://3v4l.org/ICTGZ

Special characters in property name

You can make class objects from json using following references

http://json2csharp.com/

Just paste your json string and it will generate C# class and properties inside that json.

Dealing with special characters in object property names

You can do that in one expression:

echo $obj->{'Revenues_(budget)'};

How to access property of javascript object with special character in property name

AngularJS does nothing special here. Refer to the regular rules for referencing properties in a javascript object.

In a controller: console.log($scope.data['Handedness;'])

In a view: {{ data['Handedness;'] }}

Object properties with special characters in EJS

Pass an object instead, then access properties on it.

res.render('index.ejs', { replace })


     <%= replace['x:a'] %>
<%= replace['x:b'] %>
<%= replace['y:c.d'] %>


Related Topics



Leave a reply



Submit