I would like to remove all elements of an associative array if the key has a substring of 'TB1' in the key.
My array looks like:
$output= [
'TB1_course' => 'required'
'TB1_session' => 'required'
'TB2_course' => 'required'
]
I would like to remove TB1_course and TB1_session, so that my final array looks like:
$output =[
'TB2_course' => 'required
]
Is there any way to go about doing this in an easy concise fashion?
My initial guess was to use a for each loop:
foreach ($output as $key =>$value){
//remove
}
Thank you for all the help!