views:

204

answers:

2

currently, I used PHPExcel to import excel file, there is a function $cell->getCoordinate();

I would like to ask any solution for split the cell coordinate alphabet and integer?

e.g A1, A2,

I need to know currently which row, and until which column.

I do some research about split, but not luck for it. Any idea?

+2  A: 

This:

$coord = 'AF13';
preg_match_all('~[A-Z]+|\d+~', $coord, $split);
print_r($split);

Will produce:

Array (
  [0] => Array (
    [0] => AF
    [1] => 13
  )
)
Max Shawabkeh
thank you so much for your help, I really lag of knowledge in regular expression.
Shiro
A: 

$coordinate = PHPExcel_Cell::coordinateFromString('A1'); var_dump($coordinate);

Mark Baker