3v4l.org

run code in 300+ PHP versions simultaneously
<?php function showRawCharacters($result) { $resultInHex = unpack('H*', $result); $resultInHex = $resultInHex[1]; $resultSeparated = implode(', ', str_split($resultInHex, 2)); echo $resultSeparated; } $tests = array('a', 'Z'); foreach ($tests as $packChar) { $packString = $packChar.'*'.$packChar.'*'.$packChar.'*'; echo "Packing with: ".$packString."\n"; $data = pack($packString, "foo", "bar", "baz"); echo "packed is: \n"; showRawCharacters($data); $y = unpack('Z3omg/Z3lol/Z3bbq' , $data ); echo "\nPHP 5.5 Z\n"; var_dump($y); }
Output for git.master, git.master_jit, rfc.property-hooks
Packing with: a*a*a* packed is: 66, 6f, 6f, 62, 61, 72, 62, 61, 7a PHP 5.5 Z array(3) { ["omg"]=> string(3) "foo" ["lol"]=> string(3) "bar" ["bbq"]=> string(3) "baz" } Packing with: Z*Z*Z* packed is: 66, 6f, 6f, 00, 62, 61, 72, 00, 62, 61, 7a, 00 PHP 5.5 Z array(3) { ["omg"]=> string(3) "foo" ["lol"]=> string(0) "" ["bbq"]=> string(1) "r" }

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:
43.96 ms | 402 KiB | 8 Q