vendredi 30 octobre 2020

PHP | If loop with multiple conditions

I have a problem with an if loop with more than one condition inside I bring an example to understand:

for example let's say we have 3 fields in the same database table

one

two

three

each of these 3 fields has 3 states

empty

on hold

ready

I want to see a statement only when all 3 are up ready

    <?php if($collaboratore_abilitato['one'] === 'ready'|| $collaboratore_abilitato['two'] === 'ready' || $collaboratore_abilitato['three'] === 'ready') :?>

<!-- SHOW CODE -->

<?php else: ?>

<!-- SHOW ANTOHER CODE -->


    <?php endif; ?>

and

$collaboratore_abilitato

it s a paramater for a while

my problem is that when I activate the 3 parameter it shows me the contents of show code and not of show another code

I don't understand why it should show me show another code only when the 3 statements are verified in ready

Aucun commentaire:

Enregistrer un commentaire