PHPackages                             cs278/serialization-helpers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. cs278/serialization-helpers

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

cs278/serialization-helpers
===========================

Helpers to work with serialized strings

v1.0.1(10y ago)120MITPHPPHP &gt;=5.3.0

Since Aug 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/cs278/serialization-helpers)[ Packagist](https://packagist.org/packages/cs278/serialization-helpers)[ Docs](https://github.com/cs278/serialization-helpers)[ RSS](/packages/cs278-serialization-helpers/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

Serialization Helpers
=====================

[](#serialization-helpers)

[![Build Status](https://camo.githubusercontent.com/96db0f5d1e6df9eec5b4d659793b3ba3fce392075e7f0d3d1c2c822882a9dc34/68747470733a2f2f7472617669732d63692e6f72672f63733237382f73657269616c697a6174696f6e2d68656c706572732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/cs278/serialization-helpers)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/54324736b27234f323b99cb3548255a620f5cbedd143d09431402bcc1b4dbef9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63733237382f73657269616c697a6174696f6e2d68656c706572732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/cs278/serialization-helpers/?branch=master)

Helpers for dealing with strings created by the `serialize()` function in PHP.

Usage
-----

[](#usage)

`isSerialized($value)` — Test if a supplied value is a PHP serialized string, returns `true` iff the syntax looks correct. This function may produce false negatives because Zend PHP’s `unserialize()` implementation will work on malformed strings.

`isSerialized($value, &$result)` — As above but also returns the unserialized value by reference.

`unserialize($input)` — Converts the serialized input into a PHP data type, returns the resulting data type. If an error occurs during the unserialize operation a `SyntaxError` will be thrown.

Examples
--------

[](#examples)

### Test if a value is serialized:

[](#test-if-a-value-is-serialized)

`isSerialized($value)`

```
