PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $collection = collect([ "Jul-2022" => [], "Aug-2022" => [ "annualbuffalomilksalerecordforcustomer" => "8.00", "annuala2milksalerecordforcustomer" => "5.50", "annualjerseymilksalerecordforcustomer" => "2.50", "annualbuffalomilksalerecord" => "168.00", "annuala2milksalerecord" => "0.00", "annualjerseymilksalerecord" => "390.00", ], ]); var_export( $collection->map(fn($row) => collect($row)->put('sumofmilksale', array_sum($row)) );
Show:  
Copy Clear