Skip to content
This repository was archived by the owner on Apr 25, 2026. It is now read-only.

Latest commit

 

History

History
28 lines (18 loc) · 1.04 KB

File metadata and controls

28 lines (18 loc) · 1.04 KB

back to overview


PhpObjectDictionary

Extends System.Collections.Generic.Dictionary<string, object> Implements IPhpObject

This is also the default return type for deserialized objects.

Aside from the GetClassName() and SetClassName() implementations for the IPhpObject interface, this class behaves exactly like any other Dictionary.

Like the PhpDynamicObject, it can also be used to create arbitrary PHP Objects for serialization:

var objectDictionary = new PhpObjectDictionary();
objectDictionary.Add("firstname", "Joseph");
objectDictionary.Add("lastname", "Bishop");
objectDictionary.SetClassName("Person");

PhpSerialization.Serialize(myObject);
// O:6:"Person":2:{s:9:"firstname";s:6:"Joseph";s:8:"lastname";s:6:"Bishop";}

Important:

PhpObjectDictionary only supports string keys. You can not deserialize PHP objects with integer keys using this type. This may be addressed in future releases.