I need to create a bunch of feeds in a fixed width format, they re all relatively the same in layout, but they can all have different formats.
例如:
Field 1 can be 30 bytes wide, left justified and padded with 0s Field 2 can be 20 bytes wide, right justified padded with spaces
我只想在行文中储存地板的参数,但不知道储存地板——类型参数的最佳方式,因为其固定不变,我可以重新阅读:
$field = str_pad($input, $width, $pad_string, $pad_type)
我可以把<代码>eval(>)围绕<代码>$pad_type,但似乎只是草图。
是否有更好的办法这样做?
I muck with, PHP 5.0, MySQL 4