3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // $packed = "hoge\0\0" var_dump($packed = pack('a6', 'hoge')); // PHP 5.4 $data = "hoge" // PHP 5.5 $data = "hoge\0\0" var_dump($data = unpack('a6', $packed)); // PHP 5.5 $data = "hoge" var_dump($data = unpack('Z6', $packed));
based on 3dQNL
Output for 5.5.24 - 7.1.0
string(6) "hoge" array(1) { [1]=> string(6) "hoge" } array(1) { [1]=> string(4) "hoge" }
Output for 4.4.8 - 4.4.9, 5.2.4 - 5.4.45
string(6) "hoge" array(1) { [1]=> string(4) "hoge" } Warning: unpack(): Invalid format type Z in /in/u6JjI on line 12 bool(false)
Output for 4.3.5 - 4.4.7, 5.0.0 - 5.2.3
string(6) "hoge" array(1) { [1]=> string(4) "hoge" } array(0) { }
Output for 4.3.0 - 4.3.4
string(6) "hoge" array(1) { [""]=> string(4) "hoge" } array(0) { }