yosra Posted April 18, 2013 Share Posted April 18, 2013 i need to set the size of variable for example i need to right '1' into 4 bytes or 'admin' into 2 bytes could u help me please Link to comment https://forums.phpfreaks.com/topic/277095-force-the-size-of-variable/ Share on other sites More sharing options...
Christian F. Posted April 18, 2013 Share Posted April 18, 2013 I'm afraid that this doesn't make any sense. What are you trying do do, which makes you think you need to do this? Is this an attempt at a bit field? Remember, the more details you give surrounding your code and problem, the more accurate and efficient help you'll get. Most of the time you might even get a better way to solve the problem on, than the one you're currently trying to employ. I suspect this will be one of those cases. Link to comment https://forums.phpfreaks.com/topic/277095-force-the-size-of-variable/#findComment-1425555 Share on other sites More sharing options...
yosra Posted April 18, 2013 Author Share Posted April 18, 2013 i m tryin to create a NXCP message with http://wiki.netxms.org/wiki/Communication_Protocol_Reference_Guide for example certain filed need to be written on 4 bytes like the flag : end of file=1 i need to convert it in hex and than check the size id it's on 4 bytes or no Link to comment https://forums.phpfreaks.com/topic/277095-force-the-size-of-variable/#findComment-1425569 Share on other sites More sharing options...
Barand Posted April 18, 2013 Share Posted April 18, 2013 So you had no luck with pack() and unpack() then? http://forums.phpfreaks.com/topic/276817-convert-to-bytes/?do=findComment&comment=1424207 Link to comment https://forums.phpfreaks.com/topic/277095-force-the-size-of-variable/#findComment-1425616 Share on other sites More sharing options...
yosra Posted April 18, 2013 Author Share Posted April 18, 2013 no! no luck Link to comment https://forums.phpfreaks.com/topic/277095-force-the-size-of-variable/#findComment-1425664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.