array short syntax in documentaiton (#373)

This commit is contained in:
Paul Klimov 2018-02-25 14:16:04 +02:00 committed by Adrien Crivelli
parent 0084776160
commit eb612157dd
21 changed files with 318 additions and 317 deletions

View File

@ -178,13 +178,13 @@ It is also possible to set a range of cell values in a single call by
passing an array of values to the `fromArray()` method. passing an array of values to the `fromArray()` method.
``` php ``` php
$arrayData = array( $arrayData = [
array(NULL, 2010, 2011, 2012), [NULL, 2010, 2011, 2012],
array('Q1', 12, 15, 21), ['Q1', 12, 15, 21],
array('Q2', 56, 73, 86), ['Q2', 56, 73, 86],
array('Q3', 52, 61, 69), ['Q3', 52, 61, 69],
array('Q4', 30, 32, 0), ['Q4', 30, 32, 0],
); ];
$spreadsheet->getActiveSheet() $spreadsheet->getActiveSheet()
->fromArray( ->fromArray(
$arrayData, // The data to set $arrayData, // The data to set
@ -201,7 +201,7 @@ and columns. A 1-d array will be treated as a single row, which is
particularly useful if you're fetching an array of data from a database. particularly useful if you're fetching an array of data from a database.
``` php ``` php
$rowArray = array('Value1', 'Value2', 'Value3', 'Value4'); $rowArray = ['Value1', 'Value2', 'Value3', 'Value4'];
$spreadsheet->getActiveSheet() $spreadsheet->getActiveSheet()
->fromArray( ->fromArray(
$rowArray, // The data to set $rowArray, // The data to set
@ -218,7 +218,7 @@ the following will convert it into an appropriately structured 2-d array
that can be fed to the `fromArray()` method: that can be fed to the `fromArray()` method:
``` php ``` php
$rowArray = array('Value1', 'Value2', 'Value3', 'Value4'); $rowArray = ['Value1', 'Value2', 'Value3', 'Value4'];
$columnArray = array_chunk($rowArray, 1); $columnArray = array_chunk($rowArray, 1);
$spreadsheet->getActiveSheet() $spreadsheet->getActiveSheet()
->fromArray( ->fromArray(

View File

@ -185,10 +185,10 @@ DateGroup rule identifying the selected year and month:
$columnFilter->createRule() $columnFilter->createRule()
->setRule( ->setRule(
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
array( [
'year' => 2012, 'year' => 2012,
'month' => 1 'month' => 1
) ]
) )
->setRuleType( ->setRuleType(
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP

View File

@ -308,21 +308,21 @@ This is the statistical mean.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -376,21 +376,21 @@ in which you specify a condition for the column.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -447,21 +447,21 @@ in which you specify a condition for the column.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -518,21 +518,21 @@ in which you specify a condition for the column.
#### Examples #### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -586,21 +586,21 @@ in which you specify a condition for the column.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -654,21 +654,21 @@ in which you specify a condition for the column.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -722,21 +722,21 @@ in which you specify a condition for the column.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -791,21 +791,21 @@ in which you specify a condition for the column.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -860,21 +860,21 @@ in which you specify a condition for the column.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -928,21 +928,21 @@ in which you specify a condition for the column.
##### Examples ##### Examples
``` php ``` php
$database = array( $database = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
array( 'Apple', 18, 20, 14, 105.00 ), [ 'Apple', 18, 20, 14, 105.00 ],
array( 'Pear', 12, 12, 10, 96.00 ), [ 'Pear', 12, 12, 10, 96.00 ],
array( 'Cherry', 13, 14, 9, 105.00 ), [ 'Cherry', 13, 14, 9, 105.00 ],
array( 'Apple', 14, 15, 10, 75.00 ), [ 'Apple', 14, 15, 10, 75.00 ],
array( 'Pear', 9, 8, 8, 76.80 ), [ 'Pear', 9, 8, 8, 76.80 ],
array( 'Apple', 8, 9, 6, 45.00 ), [ 'Apple', 8, 9, 6, 45.00 ],
); ];
$criteria = array( $criteria = [
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
); ];
$worksheet->fromArray( $criteria, NULL, 'A1' ) $worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' ); ->fromArray( $database, NULL, 'A4' );
@ -1055,8 +1055,8 @@ $saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType
); );
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'],
array(2008, 12, 31) [2008, 12, 31]
); );
// $retVal = 39813.0 // $retVal = 39813.0
@ -1065,8 +1065,8 @@ $retVal = call_user_func_array(
); );
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'],
array(2008, 12, 31) [2008, 12, 31]
); );
// $retVal = 1230681600 // $retVal = 1230681600
@ -1167,38 +1167,38 @@ $date1 = 1193317015; // PHP timestamp for 25-Oct-2007
$date2 = 1449579415; // PHP timestamp for 8-Dec-2015 $date2 = 1449579415; // PHP timestamp for 8-Dec-2015
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
array($date1, $date2, 'd') [$date1, $date2, 'd']
); );
// $retVal = 2966 // $retVal = 2966
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
array($date1, $date2, 'm') [$date1, $date2, 'm']
); );
// $retVal = 97 // $retVal = 97
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
array($date1, $date2, 'y') [$date1, $date2, 'y']
); );
// $retVal = 8 // $retVal = 8
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
array($date1, $date2, 'ym') [$date1, $date2, 'ym']
); );
// $retVal = 1 // $retVal = 1
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
array($date1, $date2, 'yd') [$date1, $date2, 'yd']
); );
// $retVal = 44 // $retVal = 44
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
array($date1, $date2, 'md') [$date1, $date2, 'md']
); );
// $retVal = 13 // $retVal = 13
``` ```
@ -1267,8 +1267,8 @@ $saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType
); );
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'],
array('31-Dec-2008') ['31-Dec-2008']
); );
// $retVal = 39813.0 // $retVal = 39813.0
@ -1277,8 +1277,8 @@ $retVal = call_user_func_array(
); );
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'],
array('31-Dec-2008') ['31-Dec-2008']
); );
// $retVal = 1230681600 // $retVal = 1230681600
@ -1342,8 +1342,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
``` php ``` php
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYOFMONTH'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYOFMONTH'],
array('25-Dec-2008') ['25-Dec-2008']
); );
// $retVal = 25 // $retVal = 25
``` ```
@ -1428,14 +1428,14 @@ $date1 = 37655.0; // Excel timestamp for 25-Oct-2007
$date2 = 39233.0; // Excel timestamp for 8-Dec-2015 $date2 = 39233.0; // Excel timestamp for 8-Dec-2015
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'],
array($date1, $date2) [$date1, $date2]
); );
// $retVal = 1558 // $retVal = 1558
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'],
array($date1, $date2, TRUE) [$date1, $date2, TRUE]
); );
// $retVal = 1557 // $retVal = 1557
``` ```
@ -1508,8 +1508,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
); );
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EDATE'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EDATE'],
array('31-Oct-2008',25) ['31-Oct-2008', 25]
); );
// $retVal = 40512.0 (30-Nov-2010) // $retVal = 40512.0 (30-Nov-2010)
``` ```
@ -1579,8 +1579,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
); );
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EOMONTH'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EOMONTH'],
array('31-Oct-2008',13) ['31-Oct-2008', 13]
); );
// $retVal = 40147.0 (30-Nov-2010) // $retVal = 40147.0 (30-Nov-2010)
``` ```
@ -1637,8 +1637,8 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
``` php ``` php
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'HOUROFDAY'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'HOUROFDAY'],
array('09:30') ['09:30']
); );
// $retVal = 9 // $retVal = 9
``` ```
@ -1695,8 +1695,8 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
``` php ``` php
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MINUTE'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MINUTE'],
array('09:30') ['09:30']
); );
// $retVal = 30 // $retVal = 30
``` ```
@ -1748,8 +1748,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
``` php ``` php
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MONTHOFYEAR'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MONTHOFYEAR'],
array('14-July-2008') ['14-July-2008']
); );
// $retVal = 7 // $retVal = 7
``` ```
@ -1893,8 +1893,8 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
``` php ``` php
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'SECOND'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'SECOND'],
array('09:30:17') ['09:30:17']
); );
// $retVal = 17 // $retVal = 17
``` ```
@ -1977,8 +1977,8 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
``` php ``` php
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'WEEKDAY'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'WEEKDAY'],
array('14-July-2008') ['14-July-2008']
); );
// $retVal = 7 // $retVal = 7
``` ```
@ -2037,8 +2037,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
``` php ``` php
$retVal = call_user_func_array( $retVal = call_user_func_array(
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'YEAR'), ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'YEAR'],
array('14-July-2001') ['14-July-2001']
); );
// $retVal = 2001 // $retVal = 2001
``` ```

View File

@ -107,7 +107,7 @@ reader to only load the sheets with a given name:
``` php ``` php
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$reader->setLoadSheetsOnly( array("Sheet 1", "My special sheet") ); $reader->setLoadSheetsOnly(["Sheet 1", "My special sheet"]);
$spreadsheet = $reader->load("05featuredemo.xlsx"); $spreadsheet = $reader->load("05featuredemo.xlsx");
``` ```
@ -225,7 +225,7 @@ reader to only load the sheets with a given name:
``` php ``` php
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
$reader->setLoadSheetsOnly( array("Sheet 1", "My special sheet") ); $reader->setLoadSheetsOnly(["Sheet 1", "My special sheet"]);
$spreadsheet = $reader->load("05featuredemo.xls"); $spreadsheet = $reader->load("05featuredemo.xls");
``` ```

View File

@ -198,7 +198,7 @@ of sheet names as an array parameter to the `setLoadSheetsOnly()` method.
``` php ``` php
$inputFileType = 'Xls'; $inputFileType = 'Xls';
$inputFileName = './sampleData/example1.xls'; $inputFileName = './sampleData/example1.xls';
$sheetnames = array('Data Sheet #1','Data Sheet #3'); $sheetnames = ['Data Sheet #1','Data Sheet #3'];
/** Create a new Reader of the type defined in $inputFileType **/ /** Create a new Reader of the type defined in $inputFileType **/
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
@ -292,7 +292,7 @@ class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
{ {
private $startRow = 0; private $startRow = 0;
private $endRow = 0; private $endRow = 0;
private $columns = array(); private $columns = [];
/** Get the list of rows and columns to read */ /** Get the list of rows and columns to read */
public function __construct($startRow, $endRow, $columns) { public function __construct($startRow, $endRow, $columns) {
@ -395,10 +395,11 @@ the file into that worksheet.
``` php ``` php
$inputFileType = 'Csv'; $inputFileType = 'Csv';
$inputFileNames = array('./sampleData/example1.csv', $inputFileNames = [
'./sampleData/example1.csv',
'./sampleData/example2.csv' './sampleData/example2.csv'
'./sampleData/example3.csv' './sampleData/example3.csv'
); ];
/** Create a new Reader of the type defined in $inputFileType **/ /** Create a new Reader of the type defined in $inputFileType **/
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);

View File

@ -549,29 +549,29 @@ sets a cell's style to font bold, alignment right, top border thin and a
gradient fill: gradient fill:
``` php ``` php
$styleArray = array( $styleArray = [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
), ],
'alignment' => array( 'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT, 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT,
), ],
'borders' => array( 'borders' => [
'top' => array( 'top' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
), ],
), ],
'fill' => array( 'fill' => [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR, 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
'rotation' => 90, 'rotation' => 90,
'startColor' => array( 'startColor' => [
'argb' => 'FFA0A0A0', 'argb' => 'FFA0A0A0',
), ],
'endColor' => array( 'endColor' => [
'argb' => 'FFFFFFFF', 'argb' => 'FFFFFFFF',
), ],
), ],
); ];
$spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray($styleArray); $spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray($styleArray);
``` ```
@ -690,14 +690,14 @@ selection. Here is how to apply a thick red border outline around cells
B2:G8. B2:G8.
``` php ``` php
$styleArray = array( $styleArray = [
'borders' => array( 'borders' => [
'outline' => array( 'outline' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK, 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => array('argb' => 'FFFF0000'), 'color' => ['argb' => 'FFFF0000'],
), ],
), ],
); ];
$worksheet->getStyle('B2:G8')->applyFromArray($styleArray); $worksheet->getStyle('B2:G8')->applyFromArray($styleArray);
``` ```

View File

@ -127,9 +127,9 @@ abstract class Coordinate
* *
* @param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4' * @param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4'
* *
* @return array Array containg one or more arrays containing one or two coordinate strings * @return array Array containing one or more arrays containing one or two coordinate strings
* e.g. array('B4','D9') or array(array('B4','D9'),array('H2','O11')) * e.g. ['B4','D9'] or [['B4','D9'], ['H2','O11']]
* or array('B4') * or ['B4']
*/ */
public static function splitRange($pRange) public static function splitRange($pRange)
{ {
@ -179,7 +179,7 @@ abstract class Coordinate
* *
* @param string $pRange Cell range (e.g. A1:A1) * @param string $pRange Cell range (e.g. A1:A1)
* *
* @return array Range coordinates array(Start Cell, End Cell) * @return array Range coordinates [Start Cell, End Cell]
* where Start Cell and End Cell are arrays (Column Number, Row Number) * where Start Cell and End Cell are arrays (Column Number, Row Number)
*/ */
public static function rangeBoundaries($pRange) public static function rangeBoundaries($pRange)
@ -230,8 +230,8 @@ abstract class Coordinate
* *
* @param string $pRange Cell range (e.g. A1:A1) * @param string $pRange Cell range (e.g. A1:A1)
* *
* @return array Range coordinates array(Start Cell, End Cell) * @return array Range coordinates [Start Cell, End Cell]
* where Start Cell and End Cell are arrays (Column ID, Row Number) * where Start Cell and End Cell are arrays [Column ID, Row Number]
*/ */
public static function getRangeBoundaries($pRange) public static function getRangeBoundaries($pRange)
{ {

View File

@ -7522,7 +7522,7 @@ class Xls extends BaseReader
/** /**
* read BIFF8 constant value array from array data * read BIFF8 constant value array from array data
* returns e.g. array('value' => '{1,2;3,4}', 'size' => 40} * returns e.g. ['value' => '{1,2;3,4}', 'size' => 40]
* section 2.5.8. * section 2.5.8.
* *
* @param string $arrayData * @param string $arrayData
@ -7562,7 +7562,7 @@ class Xls extends BaseReader
/** /**
* read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value' * read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value'
* section 2.5.7 * section 2.5.7
* returns e.g. array('value' => '5', 'size' => 9). * returns e.g. ['value' => '5', 'size' => 9].
* *
* @param string $valueData * @param string $valueData
* *

View File

@ -13,7 +13,7 @@ class Color
* @param array $palette Color palette * @param array $palette Color palette
* @param int $version * @param int $version
* *
* @return array RGB color value, example: array('rgb' => 'FF0000') * @return array RGB color value, example: ['rgb' => 'FF0000']
*/ */
public static function map($color, $palette, $version) public static function map($color, $palette, $version)
{ {

View File

@ -164,7 +164,7 @@ class DggContainer
} }
/** /**
* Set identifier clusters. array(<drawingId> => <max shape id>, ...). * Set identifier clusters. [<drawingId> => <max shape id>, ...].
* *
* @param array $pValue * @param array $pValue
*/ */

View File

@ -126,12 +126,12 @@ class Alignment extends Supervisor
* Apply styles from array. * Apply styles from array.
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray(
* array( * [
* 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, * 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
* 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, * 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
* 'textRotation' => 0, * 'textRotation' => 0,
* 'wrapText' => TRUE * 'wrapText' => TRUE
* ) * ]
* ); * );
* </code>. * </code>.
* *

View File

@ -114,12 +114,12 @@ class Border extends Supervisor
* *
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray(
* array( * [
* 'borderStyle' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => [
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * ]
* ) * ]
* ); * );
* </code> * </code>
* *

View File

@ -162,32 +162,32 @@ class Borders extends Supervisor
* Apply styles from array. * Apply styles from array.
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
* array( * [
* 'bottom' => array( * 'bottom' => [
* 'borderStyle' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => [
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * ]
* ), * ],
* 'top' => array( * 'top' => [
* 'borderStyle' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => [
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * ]
* ) * ]
* ) * ]
* ); * );
* </code> * </code>
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
* array( * [
* 'allBorders' => array( * 'allBorders' => [
* 'borderStyle' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => [
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * ]
* ) * ]
* ) * ]
* ); * );
* </code>. * </code>.
* *

View File

@ -87,7 +87,7 @@ class Color extends Supervisor
/** /**
* Apply styles from array. * Apply styles from array.
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') ); * $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray(['rgb' => '808080']);
* </code>. * </code>.
* *
* @param array $pStyles Array containing style information * @param array $pStyles Array containing style information

View File

@ -123,16 +123,16 @@ class Fill extends Supervisor
* Apply styles from array. * Apply styles from array.
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray(
* array( * [
* 'fillType' => Fill::FILL_GRADIENT_LINEAR, * 'fillType' => Fill::FILL_GRADIENT_LINEAR,
* 'rotation' => 0, * 'rotation' => 0,
* 'startColor' => array( * 'startColor' => [
* 'rgb' => '000000' * 'rgb' => '000000'
* ), * ],
* 'endColor' => array( * 'endColor' => [
* 'argb' => 'FFFFFFFF' * 'argb' => 'FFFFFFFF'
* ) * ]
* ) * ]
* ); * );
* </code>. * </code>.
* *

View File

@ -143,18 +143,18 @@ class Font extends Supervisor
* Apply styles from array. * Apply styles from array.
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray(
* array( * [
* 'name' => 'Arial', * 'name' => 'Arial',
* 'bold' => TRUE, * 'bold' => TRUE,
* 'italic' => FALSE, * 'italic' => FALSE,
* 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE, * 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
* 'strikethrough' => FALSE, * 'strikethrough' => FALSE,
* 'color' => array( * 'color' => [
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * ]
* ) * ]
* ); * );
* </code>. * </code>
* *
* @param array $pStyles Array containing style information * @param array $pStyles Array containing style information
* *

View File

@ -125,9 +125,9 @@ class NumberFormat extends Supervisor
* Apply styles from array. * Apply styles from array.
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray(
* array( * [
* 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE * 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
* ) * ]
* ); * );
* </code>. * </code>.
* *

View File

@ -74,12 +74,12 @@ class Protection extends Supervisor
* Apply styles from array. * Apply styles from array.
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray(
* array( * [
* 'locked' => TRUE, * 'locked' => TRUE,
* 'hidden' => FALSE * 'hidden' => FALSE
* ) * ]
* ); * );
* </code>. * </code>
* *
* @param array $pStyles Array containing style information * @param array $pStyles Array containing style information
* *

View File

@ -151,33 +151,33 @@ class Style extends Supervisor
* *
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->applyFromArray(
* array( * [
* 'font' => array( * 'font' => [
* 'name' => 'Arial', * 'name' => 'Arial',
* 'bold' => true, * 'bold' => true,
* 'italic' => false, * 'italic' => false,
* 'underline' => Font::UNDERLINE_DOUBLE, * 'underline' => Font::UNDERLINE_DOUBLE,
* 'strikethrough' => false, * 'strikethrough' => false,
* 'color' => array( * 'color' => [
* 'rgb' => '808080'
* ]
* ],
* 'borders' => [
* 'bottom' => [
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => [
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * ]
* ), * ],
* 'borders' => array( * 'top' => [
* 'bottom' => array( * 'borderStyle' => Border::BORDER_DASHDOT,
* 'borderStyle' => Border::BORDER_DASHDOT, * 'color' => [
* 'color' => array( * 'rgb' => '808080'
* 'rgb' => '808080' * ]
* ) * ]
* ), * ],
* 'top' => array( * 'quotePrefix' => true
* 'borderStyle' => Border::BORDER_DASHDOT, * ]
* 'color' => array(
* 'rgb' => '808080'
* )
* )
* ),
* 'quotePrefix' => true
* )
* ); * );
* </code> * </code>
* *

View File

@ -2712,7 +2712,7 @@ class Worksheet implements IComparable
* Extract worksheet title from range. * Extract worksheet title from range.
* *
* Example: extractSheetTitle("testSheet!A1") ==> 'A1' * Example: extractSheetTitle("testSheet!A1") ==> 'A1'
* Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1'); * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> ['testSheet 1', 'A1'];
* *
* @param string $pRange Range to extract title from * @param string $pRange Range to extract title from
* @param bool $returnRange Return range? (see example) * @param bool $returnRange Return range? (see example)

View File

@ -552,8 +552,8 @@ class Worksheet extends BIFFwriter
$lastCell = $explodes[1]; $lastCell = $explodes[1];
} }
$firstCellCoordinates = Coordinate::coordinateFromString($firstCell); // e.g. array(0, 1) $firstCellCoordinates = Coordinate::coordinateFromString($firstCell); // e.g. [0, 1]
$lastCellCoordinates = Coordinate::coordinateFromString($lastCell); // e.g. array(1, 6) $lastCellCoordinates = Coordinate::coordinateFromString($lastCell); // e.g. [1, 6]
return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, Coordinate::columnIndexFromString($firstCellCoordinates[0]) - 1, Coordinate::columnIndexFromString($lastCellCoordinates[0]) - 1); return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, Coordinate::columnIndexFromString($firstCellCoordinates[0]) - 1, Coordinate::columnIndexFromString($lastCellCoordinates[0]) - 1);
} }