I have a basic for-loop that returns some data from an Array. Inside the for-loop I have some if statements that will output data based on the results of a count() query.
So if I run the basic function,
<?php
$count_regions = count($location);
echo($count_regions);
?>
it returns the the correct counts, eg, 1, 1, 1, 2, 2, 2,.
However, I'm now trying to add the following conditions,
<?php
$count_regions = count($location);
$the_spot = "1";
if ($count_regions = "1") {
$count_debug = "1";
}
if ($count_regions = "2") {
$count_debug = "2";
}
if ($count_regions = "3") {
$count_debug = "3";
}
if ($count_regions > "3") {
$count_debug = "more than 3";
}
echo($count_debug);
?>
Now it returns 3, 3, 3, 3, 3, .... as opposed to the expected 1, 1, 1, 2, 2, 2,.
Any suggestions what I'm doing wrong?
Aucun commentaire:
Enregistrer un commentaire