Here is the code

<?php $dr = $_GET['dr']; if(empty($dr)){ echo "dr is empty...";} elseif($dr == 'kola'){(include 'k.php');} elseif($dr == 'vova'){ echo "vova2";} ?> 

How to assign more values ​​to elseif($dr == 'kola') ? for example kola2 kola3 kolyan kolka etc.?

    2 answers 2

     if(in_array($dr, array('kola2', 'kola3', 'kolyan', 'kolka'))){ //some code; } 
    • thanks, and one more question. How to make these values ​​taken from the file? for example from s.php? I tried to include but something is missing - MackD
    • And how are they stored in your file? - Opalosolo
    • you write code in another file: $ x = array ('kola2', 'kola3', 'kolyan', 'kolka'); do it include, and check if (in_array ($ dr, $ x)) { - IVsevolod
    • like that 'kola2', 'kola3', 'kolyan', 'kolka' - MackD
    • one
      If the file is text, then as an option: $ str = file_get_contents ('file.txt'); // so read the file into a string $ arr = explode (',', $ str); // so we split the string by comma and get the array $ arr = array_map (function ($ a) {return trim ($ a, "" ")}, $ arr); // so (or in another way) we remove the extra spaces and quotes - Deonis
     else if(($dr == 'kola') && ($dr == 'sss') && ($dr == 'ssss') && ($dr == 'sss1wawadwa'))