Hello.
Such code:
foreach($array as $key=>$el) { fseek($r, 3, SEEK_CUR); fputs($r, $el, 3); } Writes data to the file, if the item is less than 3 bytes - the rest is filled, I don’t know how to say it correctly, but probably with zero bytes. If you open a file in Sublime Text:
3135 3400 3535 0000 //здесь зашифровано 154 и 55, между ними заполняется 0 The fact is that the array is very large, tens of thousands of records, it is necessary to drive the pointer and record tens of thousands of times. Is there a way to write from an array to a string in the same way? It is important for me that the data be of a certain length. Those. even if the element is 1 character (1 byte), then it should occupy the same 3 bytes.
Update: Task description: I have an array of numbers that goes beyond the available memory. I store it in a file, allocating a certain number of bytes for each element. Everything suits, but takes a long time to record. I want to do something like a temporary buffer, and write elements of 100, for example.
qwerty, it will be -qwe- A1essandro