Remove all elements from array after element with searched value
Do you mean this?
if (($key = array_search($current_week_url, $week_link_arr)) !== false) {
$week_link_arr = array_slice($week_link_arr, 0, $key + 1);
}
In this case your key is the index in the array So you can simply remove the keys between this key and the rest of the array
if (($key = array_search($current_week_url, $week_link_arr)) !== false) {
array_splice($week_link_arr, $key, count($week_link_arr)-1);
}