Unexpected behavior of PHP unpack()
===

# Tests

<!-- language: php -->

    $x = sprintf( "foo\x00bar\x00baz" );
    $y = unpack( 'afoo/abar/abaz' , $x );
    print_r( $y );

<!-- language: php -->

    $x = sprintf( "foo\x00bar\x00baz" );
    $y = unpack( 'a*foo/a*bar/a*baz' , $x );
    print_r( $y );

# Results

<pre>
Array
(
    [foo] => f
    [bar] => o
    [baz] => o
)
</pre>

<pre>
Array
(
    [foo] => foobarbaz
    [bar] => 
    [baz] => 
)
</pre>

_Note that the NULL byte is always there, you can check it with `hexdump`._

# Expected result

<pre>
Array
(
    [foo] => foo
    [bar] => bar
    [baz] => baz
)
</pre>

# Notes

I know I can use `explode` to achieve a similar result. I'm not asking an alternative, I just want to understand the logic behind the `a` format character ("NUL-padded string" as the doc says).

Where does the "NULL" value get involved in all this?