3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $packed = pack('a6', 'ji'); // PHP 5.4 $data = "hoge" // PHP 5.5 $data = "hoge\0\0" var_dump($data = unpack('a1b/a1c', $packed)); // PHP 5.5 $data = "hoge" var_dump($data = unpack('Z6', $packed));
based on Pe8I0
Output for 5.5.24 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { ["b"]=> string(1) "j" ["c"]=> string(1) "i" } array(1) { [1]=> string(2) "ji" }
Output for 4.4.8 - 4.4.9, 5.2.4 - 5.4.45
array(2) { ["b"]=> string(1) "j" ["c"]=> string(1) "i" } Warning: unpack(): Invalid format type Z in /in/C7IIl on line 10 bool(false)
Output for 4.3.0 - 4.4.7, 5.0.0 - 5.2.3
array(2) { ["b"]=> string(1) "j" ["c"]=> string(1) "i" } array(0) { }