unpack on offsets in binary data in variable?
| From: | Markus Fischer | Date: | Mon, 08 Jan 2007 15:20:27 +0000 |
| Subject: | unpack on offsets in binary data in variable? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-246759@lists.php.net to get a copy of this message | ||
Hi,
I'm searching for an efficient way to use unpack on binary data within a
variable (php 5.1.something). In the past I was doing
fopen
fseek
unpack( fread(...)
fseek
etc.
Now this time I need to do the same, but I don't have an actual file: my
data is only in a variable and I don't want to operate on a file but the
variable within.
I was thinking about using substr() and passing the small chunks of data
I need to the unpack() function.
Question: does this work without problems on arbitrary binary, maybe
containing zero-byte values reliable?
thanks,
- Markus