Re: Manipulating binary data



On Apr 29, 6:36 pm, brainflakes....@xxxxxxxxxxxxxx wrote:
Hi guys,

I need to manipulate binary data (8 bit) stored in a 2 dimensional
array.

I've tried various methods (arrays, using a string filled with chr(0),
using gd lib) and so far the fastest way I've found is to actually
create an 8-bit image in GD and use imagecolorat and imagesetpixel to
read and write the data.

Are there actually any proper binary extensions or is using gd lib the
way to go (as I guess it's just dealing with binary data as a 2d array
anyway)

Andrew

I doubt that's the optimal solution. Function calls are relatively
expensive in PHP. The difference in speed you observed between the
different methods can probably be attributed to the number of calls
made per element.

Explain exactly what you're trying to do. There probably is a better
approach.

.



Relevant Pages

  • Re: Manipulating binary data
    ... I need to manipulate binary data stored in a 2 dimensional ... Are there actually any proper binary extensions or is using gd lib the ... way to go (as I guess it's just dealing with binary data as a 2d array ...
    (comp.lang.php)
  • Re: Useful class for binary data storate and manipulation
    ... > I'm trying to decide on a structure to store Message Data. ... > contains binary data of arbitrary format and length. ... > some sort of array of bytes containing whatever the message is. ... It has no functionality below the byte level, if you need to be able to set ...
    (comp.lang.java.help)
  • Re: Serialization and Deserialization
    ... But when I get the array of bytes back it is only the ... by using the buffer size of 8000. ... In the database I am using varbinary to store this binary data, ...
    (microsoft.public.dotnet.languages.csharp)
  • Problem saving binary data in OLE Object field
    ... and write binary data from the OLE Object field. ... AppendChunk byte array to DAO field ... file matches the first half of the input file. ... The second half of the output file is garbage. ...
    (comp.databases.ms-access)
  • Manipulating binary data
    ... I need to manipulate binary data stored in a 2 dimensional ... Are there actually any proper binary extensions or is using gd lib the ... way to go (as I guess it's just dealing with binary data as a 2d array ...
    (comp.lang.php)