. # This file contains code to convert an array into a string, and back again. require_once(__DIR__ . '/binary.php'); function string_to_array($data) { $header_count = pop_int($data); $out = array(); while($header_count--) { $size = pop_int($data); $out[] = substr($data, 0, $size); $data = substr($data, $size); } return $out; } function array_to_string($array) { $ret = to_raw_int(count($array)); foreach($array as $element) { $ret .= to_raw_int(strlen($element)); $ret .= $element; } return $ret; } ?>