-
Notifications
You must be signed in to change notification settings - Fork 0
objectToSerial
Corey Avis edited this page Sep 23, 2026
·
2 revisions
Converts a PHP object or array containing nested objects directly into a PHP serialized string.
objectToSerial(array|object $object): string
object (array|object) : The object (or array containing objects) to convert.
(string) : Returns a PHP serialized string representation of the converted data structure.
📌 Chains
objectToArrayandarrayToSerialto ensure all nested objects are recursively transformed into associative arrays before serialization.
$cphp->objectToSerial([id] => 10, [user] => "name", [active] => 1);
// Result: a:3:{s:2:"id";i:10;s:4:"user";s:4:"name";s:6:"active";b:1;}
- No debug errors.
objectToArray | objectToJson | serialToObject
Home | CoreyPHP | Conversion