<?php
$str = '#ORGNR "123" 1
#ACCOUNT 1010 "Kassa"
#ACCOUNT 1050 "Bank"
#IB -1 1010 1923.15
#IB 1 1050 201.42';
$arr2 = array_map(function($line){
return preg_split("/\s+/", $line);
}, explode("\n", $str));
var_dump($arr2);
- Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- array(5) {
[0]=>
array(3) {
[0]=>
string(6) "#ORGNR"
[1]=>
string(5) ""123""
[2]=>
string(1) "1"
}
[1]=>
array(3) {
[0]=>
string(8) "#ACCOUNT"
[1]=>
string(4) "1010"
[2]=>
string(7) ""Kassa""
}
[2]=>
array(3) {
[0]=>
string(8) "#ACCOUNT"
[1]=>
string(4) "1050"
[2]=>
string(6) ""Bank""
}
[3]=>
array(4) {
[0]=>
string(3) "#IB"
[1]=>
string(2) "-1"
[2]=>
string(4) "1010"
[3]=>
string(7) "1923.15"
}
[4]=>
array(4) {
[0]=>
string(3) "#IB"
[1]=>
string(1) "1"
[2]=>
string(4) "1050"
[3]=>
string(6) "201.42"
}
}
preferences:
135.33 ms | 409 KiB | 5 Q