[ create a new paste ] login | about

Link: http://codepad.org/BdCHu8PO    [ raw code | output | fork ]

PHP, pasted on Jan 7:
1
2
3
4
5
6
7
8
9
10
11
12
<?php
$str = 'WHITE BLOOD CELL COUNT      10.2        4.0-10.8
HEMOGLOBIN   8.9   ABNORMAL LOW    12-16
PLATELET COUNT     250    160-400';

$rows = explode("\n", $str);

foreach($rows as $i => $row){
    $rows[$i] = preg_split ( '/\s{2,}/' , $row);
}

var_dump($rows);


Output:
array(3) {
  [0]=>
  array(3) {
    [0]=>
    string(22) "WHITE BLOOD CELL COUNT"
    [1]=>
    string(4) "10.2"
    [2]=>
    string(9) "4.0-10.8
"
  }
  [1]=>
  array(4) {
    [0]=>
    string(10) "HEMOGLOBIN"
    [1]=>
    string(3) "8.9"
    [2]=>
    string(12) "ABNORMAL LOW"
    [3]=>
    string(6) "12-16
"
  }
  [2]=>
  array(3) {
    [0]=>
    string(14) "PLATELET COUNT"
    [1]=>
    string(3) "250"
    [2]=>
    string(7) "160-400"
  }
}


Create a new paste based on this one


Comments: