hi, im just learning php since one month ago. this is my first post on this forum! so i wanna say hi to everybody ^^.. now i hope you can help me... i need to generate a custom binary file... let me explain you fast... this is the format of the file [code] TRIADPATCHERPATCHBIN -> main -> this is the header [00][00][00][00] -> filecount -> this bytes is a count of the files inside the file ------------------------------- NOW FOR EVERY FILE ------------------- [0C][00][00][00] -> filenamecount -> the numbers of bytes in the filename originalfilename -> file_from -> the name [0C][00][00][00] -> file_tonamecount -> the numbers of bytes in the file_to destinefilename -> file_toname -> the name of the file_to =P [07][00][00][00] -> contentcount -> the lenght in bytes Content -> content -> the content of this file and the last block repeat for every file inside the file... [/code] well, so i start making a function; make_tpp($files) files is an array: $files = array('file_from.grf' => 'file_to.grf'); now i need to use the funcion pack for generate the file... i tried witout the array.. i did something like this... [code] $file_from='file_from.grf'; $file_to='file_to.grf'; $content='content test'; $data= pack('a20VVa*Va*Va*', 'TRIADPATCHERPATCHBIN', 1, strlen($file_from), $file_from, strlen($file_to), $file_to, $strlen($content), $content); #next i save it to a file... if(($fp=fopen('test.hex',"wb"))){ fwrite($fp,$data); fclose ($fp); } [/code] And thats works perfectly! but i need to pass more that one file, so i need a way to pass multi parameters to the pack function... [code] foreach ($files as $file_from => $file_to){ #[0C][00][00][00] -> filenamecount -> V $hex_format .= 'V'; $hex[] = strlen($file_origen); #originalfilename -> file_origen -> a* $hex_format .= 'a*'; $hex[] = $file_origen; #[0C][00][00][00] -> destfilenamecount -> V $hex_format .= 'V'; $hex[] = strlen($file_dest); #destinefilename -> destinefilename -> a* $hex_format .= 'a*'; $hex[] = $file_dest; #[07][00][00][00] -> contentcount -> V $_content = file_get_contents($file_origen); $hex_format .= 'V'; $hex[] = strlen($_content); #content $hex_format .= 'a*'; $hex[] = $_content; } pack($hex_format,???????????); [/code] do you understand me????!?!?!?!?!??!