Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ファイルであるデータベースがあり.txtますが、区切りフィールドではありません。たとえばfield1、1 から 22 まで、field223 から 40 までなどです。
.txt
field1
field2
PHPでこれを解析するにはどうすればよいですか?
各フィールドの位置と長さがわかっている場合、1 つの方法はSUBSTR.
SUBSTR
例:
$field1 = substr($string, 0, 21);
インデックスは 0 から始まります。