variable conditions from mysql in switch case on php/mysql? : <p>my problem is that i have to implement variable conditions which means that the user is able to define a VALUE for period of time.This data will be stored in mysql. PHP is used on server-side.</p>

<p>i.e.</p>

<pre><code>FROM 2018-01-01 TO 2018-01-03 VALUE 10; 
FROM 2018-01-04 TO 2018-01-06 VALUE 20; 
DEFAULT (used if not in time gap) VALUE 100;
</code></pre>

<p>Therefore I thought a switch case can be an option. But is it possible to have a foreach loop on cases?</p>

<p>like:</p>

<pre><code>$date = "2018-01-01";

switch ($date) {
    foreach(... as $data){
    case $data:
        //load variable
        break;
    }
    default:
        //load default values
}
</code></pre>

<p>Maybe i'm on the wrong way - pls hlp.</p>
