I have a complex algorithm that I try to code in PHP but it's a bit complicated for a beginner like me. So I need your help guys
I have an array of unknown numbers starting fron t1 up to tn. I don't know its length actually.like
(t1,t2,t3,t4,.....,tn)
And I want to test a condition on the first elemnt if not, on the last element if not will test a common condition against the values from t2 to tn-1
I also have values called s , c & b that I will use in the code.
The first condition is :
if c < s -> Do something
if c >= s and c < (s + (t1 - t2)) -> Do something else
if c >= (s + (t1 - tn)) and c < (s + (t1 + b)) -> Do something else
If non of the previous conditions were matched then I wanna test the values from t2 up to tn-1 in the following way
if c >= (s + (t1 - t2)) and c < (s + (t1 - t3)) -> Do something that's bound to t2 value
if c >= (s + (t1 - t3)) and c < (s + (t1 - t4)) -> Do somehting else
and so on up to tn-1 .. I don't know how many values there are in the array so i need to do this dynamically
Can any one help me ? It will be a great help indeed