I am editing a reservation system and I have a question. The issue is that I would like it to come out of one color or another depending on the title that I put on it. I have this code:
$color_titulo = 'style="background-color:#EAFFCF"'; //Predeterminamos un código de color y se sustituye si se cumple alguna de las siguientes reglas
if($reservadas >= $clase_celda->num_plazas){
$color_titulo = 'style="background-color:#E80909;color:#fff"';
}
if(strpos(strtoupper($clase_celda->nombre), "General") !== false){
$color_titulo = 'style="background-color:#D7F6FF"';
}
if($clase_celda->nombre=='Normal'){
$color_titulo = 'style="background-color:#a5b1c1"';
}
When the text appears "general" accompanied by something, it replaces me and works fine, but if I want to use the "normal" one, I just have to put "Normal" so that the background color changes, if I use the same format as in the previous one where puts "General" they change me in all completely.
I do not know if I explained well
In summary I want that if for example it says "Normal 10:00" or whatever is accompanied I include it.
Change the sentence:
by (when the word is always "Normal"):
or when "Normal" is a substring (for example "Normal 10:00")
You can also convert the string to uppercase as you do in the previous statement:
Ok, the solution has been used in all of them in this way:
But with the "GENERAL" IN CAPITAL LETTERS, if not, it didn't work.
PS: how can I add that they are two words in the same, for example "general" or "general 2". I'm trying
"GENERAL" or "GENERAL2"
but no