I have 2 arrays : $all_projects and $project_jobs
They look as follows :
All Projects
array(2) {
[0]=>
object(stdClass)#319 (43) {
["project_id"]=>
int(2)
["project_name"]=>
string(13) "Consteel Time"
["project_number"]=>
string(6) "2016-2"
["project_currency"]=>
string(3) "gbp"
["project_lump_value"]=>
string(4) "5000"
["project_hourly_rate"]=>
string(5) "32.50"
["project_no_staff"]=>
int(1)
["project_timeframe"]=>
string(4) "3.42"
["project_value"]=>
string(6) "153.85"
["project_colour"]=>
NULL
["project_hours_submitted"]=>
string(6) "103.85"
["leader_id"]=>
int(3)
["company_id"]=>
int(1)
["start_date"]=>
string(19) "2016-03-29 00:00:00"
["end_date"]=>
string(19) "2016-07-28 00:00:00"
["status"]=>
string(4) "open"
["created_at"]=>
string(19) "2016-03-10 12:19:45"
["updated_at"]=>
string(19) "2016-03-10 12:58:22"
["deleted_at"]=>
NULL
["user_id"]=>
int(3)
["user_firstname"]=>
string(4) "Adam"
["user_surname"]=>
string(10) "Hutchinson"
["user_email"]=>
string(29) "adam.hutchinson@mobilerock.it"
["user_password"]=>
string(60) "$2y$10$brjhQpV.vH2I65B1NSiQOOuUl.nXtsHXCmmyZd89f.PCKPpXlnqkm"
["user_telephone"]=>
string(2) "01"
["holiday_allocation"]=>
NULL
["user_rate"]=>
NULL
["user_number"]=>
NULL
["payroll_no"]=>
NULL
["role_id"]=>
int(1)
["remember_token"]=>
string(60) "QlIUYYO0ksoSzOdNlpUA3hkPnBm8K2aD1JJhMUiqGBGMaxsYowovbRlVORyU"
["forgotten_token"]=>
NULL
["staff_no"]=>
NULL
["staff_dept"]=>
NULL
["last_login"]=>
string(19) "2016-05-13 10:03:08"
["company_name"]=>
string(15) "Koodoo Creative"
["company_address1"]=>
string(2) "2 "
["company_address2"]=>
string(13) "Parsons Court"
["company_city"]=>
string(15) "Newton Aycliffe"
["company_telephone"]=>
string(11) "08456445089"
["company_postcode"]=>
string(8) " DL5 6ZE"
["company_lat"]=>
string(14) "54.60049900487"
["company_long"]=>
string(16) "-1.5687729520348"
}
}
Project Jobs
array(3) {
[0]=>
object(stdClass)#321 (45) {
["project_job_id"]=>
int(6)
["project_job_name"]=>
string(25) "Consteel Time Project - 1"
["project_number"]=>
string(6) "2016-2"
["project_job_number"]=>
string(10) "2016-2-001"
["project_job_currency"]=>
string(3) "gbp"
["project_job_lump_value"]=>
string(3) "200"
["project_job_hourly_rate"]=>
string(5) "32.50"
["project_job_no_staff"]=>
int(5)
["project_job_timeframe"]=>
string(4) "0.03"
["project_job_value"]=>
string(4) "6.15"
["project_job_hours_submitted"]=>
string(6) "-13.85"
["project_colour"]=>
NULL
["leader_id"]=>
int(3)
["company_id"]=>
int(1)
["project_id"]=>
int(2)
["start_date"]=>
string(19) "2016-05-11 00:00:00"
["end_date"]=>
string(19) "2016-05-20 00:00:00"
["status"]=>
string(4) "open"
["created_at"]=>
string(19) "2016-03-10 12:19:45"
["updated_at"]=>
string(19) "2016-03-10 12:58:22"
["deleted_at"]=>
NULL
["user_id"]=>
int(3)
["user_firstname"]=>
string(4) "Adam"
["user_surname"]=>
string(10) "Hutchinson"
["user_email"]=>
string(29) "adam.hutchinson@mobilerock.it"
["user_password"]=>
string(60) "$2y$10$brjhQpV.vH2I65B1NSiQOOuUl.nXtsHXCmmyZd89f.PCKPpXlnqkm"
["user_telephone"]=>
string(2) "01"
["holiday_allocation"]=>
NULL
["user_rate"]=>
NULL
["user_number"]=>
NULL
["payroll_no"]=>
NULL
["role_id"]=>
int(1)
["remember_token"]=>
string(60) "QlIUYYO0ksoSzOdNlpUA3hkPnBm8K2aD1JJhMUiqGBGMaxsYowovbRlVORyU"
["forgotten_token"]=>
NULL
["staff_no"]=>
NULL
["staff_dept"]=>
NULL
["last_login"]=>
string(19) "2016-05-13 10:03:08"
["company_name"]=>
string(15) "Koodoo Creative"
["company_address1"]=>
string(2) "2 "
["company_address2"]=>
string(13) "Parsons Court"
["company_city"]=>
string(15) "Newton Aycliffe"
["company_telephone"]=>
string(11) "08456445089"
["company_postcode"]=>
string(8) " DL5 6ZE"
["company_lat"]=>
string(14) "54.60049900487"
["company_long"]=>
string(16) "-1.5687729520348"
}
I then merge the two together. What I'd then like to do is sort the array by the "project_id" so that when showing the data back out they all sit together.
How can I achieve this?
Thanks