Consider the array and variable shown below:
array = ['complete','in_progress','planned'];
value = 'planned';
The goal is to always sort the array starting with the 'value' variable, resulting in:
array = ['planned','in_progress','complete'];
For example:
array = ['complete','in_progress','planned'];
value = 'in_progress';
The expected output would be:
array = ['in_progress','complete','planned'];
I have tried various approaches without success. Do you have any concise and efficient ideas?