ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My php knowledge is very poor (only worked with strings so far), and I am faced which a task that is a real challenge for me:
I have a variable, that contains data of different type, in this order:
byte, byte, string, string, string, string, short, byte, byte, byte, byte, byte, byte, byte, string
Strings are of variable length. How could this data be parsed into variables of the right type, and then all converted to strings?
What are the functions to use?
P.S.
Strings are unicode ones, and they are delimited by "
Thank you, but I have almost solved this (after realizing that most php string function are "byte safe"), I only need a little help now:
Strings seem to be separated not by " but by ascii 0 characters (at least ord returned 0 as the ascii code of the character following each string in the data).
Why does this return nothing then?:
/ $string contains the data
$delim = "%00";
$pos = strpos ($string, $delim);
echo $pos;
The only thing I need to solve this is to get the position of the ascii 0 character, but the above prints nothing, $pos seem to be empty...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.