Port simple C++ to PHP code -


i need similar in php:

struct msg_head {         unsigned char c;         unsigned char size;         unsigned char headcode; };  struct get_info {         struct msg_head h;         unsigned char type;         unsigned short port;         char name[50];         unsigned short code; };  void example(get_info * msg) {     printf(msg->name);     printf(msg->code); } 

i created general purpose php struct class, emulate c-structs, might useful you.

code , examples here: http://bran.name/dump/php-struct

example usage:

// define 'coordinates' struct 3 properties $coords = struct::factory('degree', 'minute', 'pole');  // create 2 latitude/longitude numbers $lat = $coords->create(35, 40, 'n'); $lng = $coords->create(139, 45, 'e');  // use different values name echo $lat->degree . '° ' . $lat->minute . "' " . $lat->pole; 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -