Supported Versions: PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8
Calculate the sum of values in an array
<?php array_sum(array $array): int|float
<?php public function processColumns($results, $sql = '')
{
$hasPrimaryKey = array_sum(array_column($results, 'primary')) === 1;
return array_map(function ($result) use ($hasPrimaryKey, $sql) {
$result = (object) $result;
<?php $this->assertDoesNotEnumerateCollection($data, function ($collection) {
$collection->flatMap(function ($values) {
return array_sum($values);
});
});
<?php $mapper = function ($part) {
return array_sum(str_split($part));
};
<?php private static function convertAlphaVersionToIntVersion($alpha)
{
return strlen($alpha) * (-ord('a') + 1) + array_sum(array_map('ord', str_split($alpha)));
}
<?php private function getFullWidth(array $columnWidths): int
{
return array_sum($columnWidths) + (count($columnWidths) * $this->columnPadding * 2) + (count($columnWidths) + 1);
}
public static function make()
<?php $borderCharacter = ($hasBorder() ? $theme->getVariables()->get('chart.borders.' . $borderStyle . '.top') : $theme->getVariables()->get('chart.borders.thin.top'));
$total = array_sum(array_column($chartData, 'value'));
foreach ($chartData as $key => $value) {