I'm very new to PHP so any help here is greatly appreciated. I have an array that I need to search and return partial and exact matches. Here's the array and where I've started code-wise:
$employeeList = array(
array(
'action' => false,
'title' => '2015 Performance Appraisal - Basille, Victor P.',
'type' => 'Employee Assessment',
'status' => 'Evaluate',
'date' => 'Dec 12, 2015',
'actions' => array('Start','Delete','View Progress','Manage Rater and Peers','Print'),
'employeeName' => 'Basille, Victor P.',
'employeeProgress' => 0,
'employeeStatus' => 'Not Yet Started',
'raterName' => 'Crane, Davy L.',
'raterProgress' => 0,
'raterStatus' => 'Not Yet Started',
'peers' => 3,
'peersComplete' => 0
),
array(
'action' => true,
'title' => '2015 Performance Appraisal - Bradford, Julie D.',
'type' => 'Employee Assessment',
'status' => 'Evaluate',
'date' => 'Dec 12, 2015',
'actions' => array('Resume','Reset','View Progress','Delete','Manage Rater and Peers','Print'),
'employeeName' => 'Bradford, Julie D.',
'employeeProgress' => 10,
'employeeStatus' => 'In Progress',
'raterName' => 'Crane, Davy L.',
'raterProgress' => 60,
'raterStatus' => 'In Progress',
'peers' => 3,
'peersComplete' => 1
),
array(
'action' => false,
'title' => '2015 Performance Appraisal - Fiedler, Joanne M.',
'type' => 'Employee Assessment',
'status' => 'Review',
'date' => 'Dec 12, 2015',
'actions' => array('View','Reset','Revert','View Progress','Print'),
'employeeName' => 'Fiedler, Joanne M.',
'employeeProgress' => 100,
'employeeStatus' => 'Submitted',
'raterName' => 'Fay, Lester P.',
'raterProgress' => 100,
'raterStatus' => 'Submitted',
'peers' => 3,
'peersComplete' => 3
)
);
$search_term = 'Victor';
$key = array_search($search_term, array_column($employeeList, 'title'));
This works great, except it only works for exact matches of the 'title'. How can I make this return partial matches as well?
Thanks.