tags:

views:

43

answers:

2

How to merge these (make this code shorter)?

$match_1 = false;
$match_2 = false;
$match_3 = false;
$match_4 = false;
$match_5 = false;

And how to shorter this code:

if($match_1 == false) { ... } // if(!$match) must work?
+2  A: 
$match_1 = $match_2 = $match_3 = $match_4 = $match_5 = false; 

Though using an array might be better

$match = array_fill(1,5,false);
Mark Baker
+1  A: 

You can use an array:

$match = array(false, false, ...);

You don't know what you want, but you can check if there's any false or true elements with:

if (in_array(true/false, $match, true)) { ... }
Artefacto