'PHP equivalent for Python's protlib

I've been using PHP's unpack to convert binary data to human readable strings and tried bitwasp/buffertools package as well but neither provide ability to get dynamic bytes.

Is there a PHP equivalent for Python's protlib library which can create objects of binary data with dynamic byte sizes.

For example in python I can use previous input value to get forward l bytes here without extra loops or tricks:

class A(CStruct)
   a = CUChar()
   l = CUShort()
   t = CString(length = "l")

Edit: I'm trying to convert binary data/file to human recognizable strings.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source