Serialize PHP array

Input data

This form allows you convert PHP array to serialized string, you only need to insert the array syntax [...] or array(...), paste or upload your array below:


Your result can be seen below.

Result of converting a PHP array to serialized string

Move to "Paste Code" for Save it

About php array serialization

About this tool

The Serialize PHP array was created for online converting array of PHP into appropriate serialized string. This can come in handy for testing or debugging your arrays, also for fast formatting and adding serialized string to your config or anywhere else.

How it Works?

Just paste your PHP array to the textarea above and click to the button "Convert" and you will get serialized string in the next textarea. PHP array should be without variables and functions, there should be a clean syntax like [...] or array(...).

Example of serializing a php array

Before:
[
  'first_section' => [
    'one' => '1',
    'test' => 'sample',
    'job' => 'DEVELOPER',
  ],
  'second_section' => [
    'path' => '/var/test',
    'URL' => 'https://wtools.io/',
    'second_section' => [
      'one' => '1 associated',
      'two' => '2 associated',
      0 => '1 unassociated',
      1 => '2 unassociated',
    ],
  ],
  'third_section' => [
    'version' => ['7.0','7.1','7.2','7.3'],
  ],
]
After:
a:3:{s:13:"first_section";a:3:{s:3:"one";s:1:"1";s:4:"test";s:6:"sample";s:3:"job";s:9:"DEVELOPER";}s:14:"second_section";a:3:{s:4:"path";s:9:"/var/test";s:3:"URL";s:18:"https://wtools.io/";s:14:"second_section";a:4:{s:3:"one";s:12:"1 associated";s:3:"two";s:12:"2 associated";i:0;s:14:"1 unassociated";i:1;s:14:"2 unassociated";}}s:13:"third_section";a:1:{s:7:"version";a:4:{i:0;s:3:"7.0";i:1;s:3:"7.1";i:2;s:3:"7.2";i:3;s:3:"7.3";}}}
After the conversion, you can apply serialized string to your project or use it for some other purpose.