Given that I have generated array of date, sales and type(customer,partner):
array(5) {
[0]=>
array(3) {
["date"]=>
string(19) "25/03/2019 12:00 am"
["sales"]=>
string(2) "95"
["type"]=>
string(8) "customer"
}
[1]=>
array(3) {
["date"]=>
string(18) "25/03/2019 1:00 pm"
["sales"]=>
string(5) "112.5"
["type"]=>
string(8) "customer"
}
[2]=>
array(3) {
["date"]=>
string(18) "25/03/2019 1:20 pm"
["sales"]=>
string(5) "132.5"
["type"]=>
string(8) "customer"
}
[3]=>
array(3) {
["date"]=>
string(18) "25/03/2019 3:10 pm"
["sales"]=>
string(2) "19"
["type"]=>
string(7) "partner"
}
[4]=>
array(3) {
["date"]=>
string(18) "25/03/2019 4:07 pm"
["sales"]=>
string(3) "7.5"
["type"]=>
string(7) "partner"
}
}
and I want to arrange it into something like this in table form:
If the date object is within the range of first week of the month it will get those date and add the sales of customer and partner. However, the column of customer and partner must be separated by column, then get the sum of customer and partner column to get the total on the 4rth column.
I found something on this post but it didn't help me out PHP get number of week for current month only using php.