/** * Method to encode multiple words and get the full size of these. * @param array $words An array with all words which will be encoded. * @return array An array with all words and the full size. * @since 1.0.0 */ private function encodeWords($words) { $encodedWords = ''; $size = 0; //encode all words and save on one string. foreach ($words as $word) { $encodedWords .= Encoding::encodeInt32(strlen($word)); $encodedWords .= $word; $encodedWords .= chr(0); $size += strlen($word) + 5; } //return the encoded words and sizes. return array($size, $encodedWords); }