3v4l.org

run code in 300+ PHP versions simultaneously
<?php $corrupted = <<<STRING a:4:{i:0;s:3:"three";i:1;s:5:"five";i:2;s:2:"newline1 newline2";i:3;s:6:"garçon";} STRING; echo $corrupted; echo "\n---\n"; echo "fails to allow newline characers:\n"; var_export(unserialize(preg_replace_callback('!s:(\d+):"(.*?)";!', function($m) { return 's:'.mb_strlen($m[2]).':"'.$m[2].'";'; }, $corrupted))); echo "\n\nfails to appropriately count bytes:\n"; var_export(unserialize(preg_replace_callback('!s:(\d+):"(.*?)";!s', function($m) { return 's:'.mb_strlen($m[2]).':"'.$m[2].'";'; }, $corrupted))); echo"\n---\n"; echo "USE THIS PATTERN WITH THIS REPLACEMENT:\n"; var_export(preg_replace_callback( '/s:\d+:"(.*?)";/s', function ($m) { return "s:" . strlen($m[1]) . ":\"{$m[1]}\";"; }, $corrupted ));
Output for git.master, git.master_jit
a:4:{i:0;s:3:"three";i:1;s:5:"five";i:2;s:2:"newline1 newline2";i:3;s:6:"garçon";} --- fails to allow newline characers: Notice: unserialize(): Error at offset 47 of 83 bytes in /in/Cf6Nh on line 11 false fails to appropriately count bytes: Notice: unserialize(): Error at offset 80 of 84 bytes in /in/Cf6Nh on line 14 false --- USE THIS PATTERN WITH THIS REPLACEMENT: 'a:4:{i:0;s:5:"three";i:1;s:4:"five";i:2;s:17:"newline1 newline2";i:3;s:7:"garçon";}'
Output for rfc.property-hooks
a:4:{i:0;s:3:"three";i:1;s:5:"five";i:2;s:2:"newline1 newline2";i:3;s:6:"garçon";} --- fails to allow newline characers: Warning: unserialize(): Error at offset 47 of 83 bytes in /in/Cf6Nh on line 11 false fails to appropriately count bytes: Warning: unserialize(): Error at offset 80 of 84 bytes in /in/Cf6Nh on line 14 false --- USE THIS PATTERN WITH THIS REPLACEMENT: 'a:4:{i:0;s:5:"three";i:1;s:4:"five";i:2;s:17:"newline1 newline2";i:3;s:7:"garçon";}'

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
132.88 ms | 408 KiB | 5 Q