2016-10-10 36 views
0

我一直在試圖弄清楚是否PHP這樣的語句包執行。PHP包 - 結合像Perl這樣的兩個包代碼

在perl的這個作品:

pack('A4/A*', "Humpty-Dumpty");

Perl的文檔:在PHP

Combining two pack codes with a slash (/) associates them with a single value from the argument list. In pack, the length of the argument is taken and packed according to the first code while the argument itself is added after being converted with the template code after the slash.

當我嘗試包這樣的事情越來越錯誤:

Warning: pack(): Type /: unknown format code

和包只返回false。

有人有同樣的問題嗎? (或自定義代碼/庫,以解決這個問題)

+0

根據不支持的[docs](http://php.net/pack)。 – vascowhite

+0

是的我知道,只是尋找一些解決方法/庫,可以提供此功能或一些建議如何實現它... –

回答

0

爲了支持類似perl的包定義,我實現了定義的預處理。