Home/Guides/PHP Serialized String Examples

PHP Serialization Guides

PHP Serialized String Examples

Examples of PHP serialized strings for arrays, strings, booleans, nulls, and nested values.

PHP serialized strings encode type, length, and value. Reading the pattern helps when debugging stored payloads.

Examples

serialize('test'); // s:4:"test";
serialize(true);   // b:1;
serialize(null);   // N;

Array example:

serialize(['name' => 'Ada']);
// a:1:{s:4:"name";s:3:"Ada";}

Common errors

Serialized string lengths count bytes. Manual edits can break payloads when lengths are not updated.

Try the PHP Serialized Data Viewer.

FAQ

What does s:4 mean?

It means a string with a byte length of 4.

Why did my edited serialized string break?

String lengths must match the exact byte length of the stored text.

Related tools

Related guides