<?php
/* This is a test assignment
Assignment: Filter Employees by Salary Range and Sort by Hire Date
Objective:
You are given a JSON string containing employee data with name, salary, and hire_date.
Write a PHP function that:
-> Filters employees with salaries in a specified range (e.g., $40,000 to $90,000).
-> Sorts them by hire date in ascending order.
-> Returns a comma-separated list of employee names with hire dates.
eg. David Jones (2017, October 22)
Emily White (2018, April 12)
*/
$json_data = '{
"18719": {"name": "John Doe", "salary": 75000, "hire_date": "2019, May 01"},
"18720": {"name": "Jane Smith", "salary": 45000, "hire_date": "2021, January 15"},
"18721": {"name": "David Jones", "salary": 60000, "hire_date": "2017, October 22"},
"18722": {"name": "Susan Green", "salary": 95000, "hire_date": "2015, August 05"},
"18723": {"name": "Michael Lee", "salary": 30000, "hire_date": "2020, November 10"},
"18724": {"name": "Emily White", "salary": 80000, "hire_date": "2018, April 12"},
"18725": {"name": "Robert Brown", "salary": 68000, "hire_date": "2016, December 14"},
"18726": {"name": "Sophia Harris", "salary": 72000, "hire_date": "2022, March 18"},
"18727": {"name": "William Clark", "salary": 54000, "hire_date": "2021, July 07"},
"18728": {"name": "Olivia Lewis", "salary": 46000, "hire_date": "2019, August 19"},
"18729": {"name": "Liam Walker", "salary": 62000, "hire_date": "2018, February 25"},
"18730": {"name": "Mia Martinez", "salary": 53000, "hire_date": "2020, September 30"},
"18731": {"name": "Noah Wilson", "salary": 70000, "hire_date": "2017, June 11"},
"18732": {"name": "Emma Robinson", "salary": 48000, "hire_date": "2016, April 05"},
"18733": {"name": "Lucas Scott", "salary": 59000, "hire_date": "2019, November 20"}
}';
PD9waHAKCi8qIFRoaXMgaXMgYSB0ZXN0IGFzc2lnbm1lbnQKQXNzaWdubWVudDogRmlsdGVyIEVtcGxveWVlcyBieSBTYWxhcnkgUmFuZ2UgYW5kIFNvcnQgYnkgSGlyZSBEYXRlCk9iamVjdGl2ZToKWW91IGFyZSBnaXZlbiBhIEpTT04gc3RyaW5nIGNvbnRhaW5pbmcgZW1wbG95ZWUgZGF0YSB3aXRoIG5hb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