3v4l.org

run code in 300+ PHP versions simultaneously
<?php $corrupted_byte_counts = <<<STRING a:10:{s:16:"submit_editorial";b:0;s:15:"submit_orig_url";s:13:"www.bbc.co.uk";s:12:"submit_title";s:14:"No title found";s:14:"submit_content";s:12:"dnfsdkfjdfdf";s:15:"submit_category";i:2;s:11:"submit_tags";s:3:"bbc";s:9:"submit_id";b:0;s:16:"submit_subscribe";i:0;s:15:"submit_comments";s:4:"open";s:5:"image";s:19:"C:fakepath100.jpg";} STRING; $repaired = preg_replace_callback( '/s:\d+:"(.*?)";/s', function ($m) { return 's:' . strlen($m[1]) . ":\"{$m[1]}\";"; }, $corrupted_byte_counts ); echo "corrupted serialized array:\n$corrupted_byte_counts"; echo "\n---\n"; echo "repaired serialized array:\n$repaired"; echo "\n---\n"; print_r(unserialize($repaired)); // unserialize repaired string
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.32, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.26, 8.0.0 - 8.0.13, 8.1rc1 - rc3
corrupted serialized array: a:10:{s:16:"submit_editorial";b:0;s:15:"submit_orig_url";s:13:"www.bbc.co.uk";s:12:"submit_title";s:14:"No title found";s:14:"submit_content";s:12:"dnfsdkfjdfdf";s:15:"submit_category";i:2;s:11:"submit_tags";s:3:"bbc";s:9:"submit_id";b:0;s:16:"submit_subscribe";i:0;s:15:"submit_comments";s:4:"open";s:5:"image";s:19:"C:fakepath100.jpg";} --- repaired serialized array: a:10:{s:16:"submit_editorial";b:0;s:15:"submit_orig_url";s:13:"www.bbc.co.uk";s:12:"submit_title";s:14:"No title found";s:14:"submit_content";s:12:"dnfsdkfjdfdf";s:15:"submit_category";i:2;s:11:"submit_tags";s:3:"bbc";s:9:"submit_id";b:0;s:16:"submit_subscribe";i:0;s:15:"submit_comments";s:4:"open";s:5:"image";s:17:"C:fakepath100.jpg";} --- Array ( [submit_editorial] => [submit_orig_url] => www.bbc.co.uk [submit_title] => No title found [submit_content] => dnfsdkfjdfdf [submit_category] => 2 [submit_tags] => bbc [submit_id] => [submit_subscribe] => 0 [submit_comments] => open [image] => C:fakepath100.jpg )
Output for 4.4.3 - 4.4.9, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/DA7IY on line 8
Process exited with code 255.
Output for 4.4.2, 5.1.2
Parse error: syntax error, unexpected T_FUNCTION in /in/DA7IY on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/DA7IY on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/DA7IY on line 8
Process exited with code 255.

preferences:
28.75 ms | 465 KiB | 5 Q